Skip to content

Commit

Permalink
fixup! ✨(front) manage chat user useParticipantsStore on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoLC committed Apr 4, 2023
1 parent 2deea47 commit a74daa0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,28 @@ describe('<VideoInfoBar />', () => {
participants: [
{
id: 'id-anonymous',
userJid: 'userJid-anonymous',
isInstructor: false,
isOnStage: false,
name: 'my anonymous name',
},
{
id: 'id-anonymous-2',
userJid: 'userJid-anonymous',
isInstructor: false,
isOnStage: true,
name: 'my anonymous name 2',
},
{
id: 'id-named',
userJid: 'userJid-anonymous',
isInstructor: false,
isOnStage: false,
name: 'my name',
},
{
id: 'id-instructor',
userJid: 'userJid-anonymous',
isInstructor: true,
isOnStage: true,
name: 'my instructor',
Expand Down Expand Up @@ -260,16 +264,19 @@ describe('<VideoInfoBar />', () => {
participants: [
{
...mockParticipant,
userJid: 'userJid-anonymous',
isInstructor: true,
isOnStage: false,
},
{
...mockParticipant,
userJid: 'userJid-anonymous',
isInstructor: false,
isOnStage: true,
},
{
...mockParticipant,
userJid: 'userJid-anonymous',
isInstructor: false,
isOnStage: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ describe('<LiveVideoPanel />', () => {
participants: [
{
...mockParticipant,
userJid: 'userJid-anonymous',
isInstructor: false,
isOnStage: false,
},
Expand Down Expand Up @@ -154,6 +155,7 @@ describe('<LiveVideoPanel />', () => {
participants: [
{
...mockParticipant,
userJid: 'userJid-anonymous',
isInstructor: false,
isOnStage: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,37 @@ const mockedParticipantOnStage2 = participantMockFactory();

const mockedParticipantOnStage1Full = {
...mockedParticipantOnStage1,
userJid: 'userJid-stage1',
isInstructor: false,
isOnStage: true,
};

const mockedParticipantOnStage2Full = {
...mockedParticipantOnStage2,
userJid: 'userJid-stage2',
isInstructor: false,
isOnStage: true,
};

const participant1 = {
id: '[email protected]',
userJid: 'userJid-student1',
isInstructor: true,
isOnStage: false,
name: 'Student 1',
};

const participant2 = {
id: '[email protected]',
userJid: 'userJid-student2',
isInstructor: false,
isOnStage: false,
name: 'Student 2',
};

const participant3 = {
id: '[email protected]',
userJid: 'userJid-student3',
isInstructor: false,
isOnStage: false,
name: 'Student 3',
Expand Down Expand Up @@ -230,12 +235,14 @@ describe('<ViewersList /> when user is an instructor', () => {
participants: [
{
id: 'id-anonymous',
userJid: 'userJid-anonymous',
isInstructor: false,
isOnStage: false,
name: anonymousName,
},
{
id: 'id-named',
userJid: 'userJid-anonymous',
isInstructor: false,
isOnStage: false,
name: 'my name',
Expand Down Expand Up @@ -269,6 +276,7 @@ describe('<ViewersList /> when user is a student', () => {
act(() =>
useParticipantsStore.getState().addParticipant({
id: '[email protected]',
userJid: 'userJid-instructor',
isInstructor: true,
isOnStage: true,
name: 'Instructor',
Expand All @@ -279,6 +287,7 @@ describe('<ViewersList /> when user is a student', () => {
act(() =>
useParticipantsStore.getState().addParticipant({
id: '[email protected]',
userJid: 'userJid-student1',
isInstructor: false,
isOnStage: false,
name: 'Student 1',
Expand All @@ -289,6 +298,7 @@ describe('<ViewersList /> when user is a student', () => {
act(() =>
useParticipantsStore.getState().addParticipant({
id: '[email protected]',
userJid: 'userJid-student2',
isInstructor: false,
isOnStage: false,
name: 'Student 2',
Expand All @@ -304,6 +314,7 @@ describe('<ViewersList /> when user is a student', () => {
act(() =>
useParticipantsStore.getState().addParticipant({
id: '[email protected]',
userJid: 'userJid-student2',
isInstructor: false,
isOnStage: false,
name: 'Student 2',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,28 @@ describe('sortParticipantNotOnStage', () => {
it('sorts participants', () => {
const anonymous1: ParticipantType = {
id: 'id1',
userJid: 'userJid-id1',
name: generateAnonymousNickname(),
isInstructor: false,
isOnStage: false,
};
const anonymous2: ParticipantType = {
id: 'id2',
userJid: 'userJid-id2',
name: generateAnonymousNickname(),
isInstructor: false,
isOnStage: false,
};
const registered1: ParticipantType = {
id: 'id3',
userJid: 'userJid-id3',
name: 'John Wick',
isInstructor: false,
isOnStage: false,
};
const registered2: ParticipantType = {
id: 'id4',
userJid: 'userJid-id4',
name: 'Jack Sparrow',
isInstructor: false,
isOnStage: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,47 @@ import { useParticipantsStore } from '.';

const participant1 = {
id: '[email protected]',
userJid: 'userJid-instructor1',
isInstructor: true,
isOnStage: true,
name: 'Instructor 1',
};

const participant2 = {
id: '[email protected]',
userJid: 'userJid-instructor2',
isInstructor: true,
isOnStage: true,
name: 'Instructor 2',
};

const participant3 = {
id: '[email protected]',
userJid: 'userJid-student1',
isInstructor: false,
isOnStage: true,
name: 'Student 1',
};

const participant4 = {
id: '[email protected]',
userJid: 'userJid-student2',
isInstructor: false,
isOnStage: false,
name: 'Student 2',
};

const sameIdParticipant1 = {
id: '[email protected]',
userJid: 'userJid-instructor1',
isInstructor: false,
isOnStage: false,
name: 'Generic participant',
};

const sameNameParticipant1 = {
id: '[email protected]',
userJid: 'userJid-generic',
isInstructor: false,
isOnStage: false,
name: 'Instructor 1',
Expand Down

0 comments on commit a74daa0

Please sign in to comment.