-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨(front) add the jid in ParticipantType
Add the jid in ParticipantType and update the participantTrackingPlugin in order to record this information jointly to the name of the user.
- Loading branch information
Showing
3 changed files
with
61 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,62 @@ | ||
import { useParticipantsStore } from '.'; | ||
|
||
const participant1 = { | ||
id: '[email protected]', | ||
isInstructor: true, | ||
isOnStage: true, | ||
name: 'Instructor', | ||
name: 'Instructor 1', | ||
}; | ||
|
||
const participant2 = { | ||
id: '[email protected]', | ||
isInstructor: true, | ||
isOnStage: true, | ||
name: 'Instructor 2', | ||
}; | ||
|
||
const participant3 = { | ||
id: '[email protected]', | ||
isInstructor: false, | ||
isOnStage: true, | ||
name: 'Student 1', | ||
}; | ||
|
||
const participant3 = { | ||
const participant4 = { | ||
id: '[email protected]', | ||
isInstructor: false, | ||
isOnStage: false, | ||
name: 'Student 2', | ||
}; | ||
|
||
const sameIdParticipant1 = { | ||
id: '[email protected]', | ||
isInstructor: false, | ||
isOnStage: false, | ||
name: 'Generic participant', | ||
}; | ||
|
||
const sameNameParticipant1 = { | ||
id: '[email protected]', | ||
isInstructor: false, | ||
isOnStage: false, | ||
name: 'Instructor 1', | ||
}; | ||
|
||
describe('useParticipantsStore', () => { | ||
it('executes useParticipantsStore/addParticipant', () => { | ||
expect(useParticipantsStore.getState().participants).toEqual([]); | ||
|
||
useParticipantsStore.getState().addParticipant(participant4); | ||
useParticipantsStore.getState().addParticipant(participant1); | ||
useParticipantsStore.getState().addParticipant(participant2); | ||
useParticipantsStore.getState().addParticipant(participant3); | ||
useParticipantsStore.getState().addParticipant(participant2); | ||
|
||
// Expect array to be alphabetically ordered, with instructors first | ||
expect(useParticipantsStore.getState().participants).toEqual([ | ||
participant1, | ||
participant2, | ||
participant3, | ||
participant4, | ||
]); | ||
}); | ||
|
||
|
@@ -46,4 +73,14 @@ describe('useParticipantsStore', () => { | |
participant2, | ||
]); | ||
}); | ||
|
||
it('tries to add participant with same id and same name', () => { | ||
useParticipantsStore.getState().addParticipant(participant1); | ||
useParticipantsStore.getState().addParticipant(sameIdParticipant1); | ||
useParticipantsStore.getState().addParticipant(sameNameParticipant1); | ||
|
||
expect(useParticipantsStore.getState().participants).toEqual([ | ||
participant1, | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters