-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: Attach breakoutGroup to all remote and local participants on ro…
…om_joined and breakout_group_joined signal events
- Loading branch information
1 parent
e59ee3e
commit 392e210
Showing
15 changed files
with
171 additions
and
56 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@whereby.com/core": minor | ||
"@whereby.com/media": patch | ||
--- | ||
|
||
Add missing `breakoutGroup` property to all in-room participants |
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
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
65 changes: 65 additions & 0 deletions
65
packages/core/src/redux/slices/__tests__/localParticipant.unit.ts
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { localParticipantSlice } from "../localParticipant"; | ||
import { signalEvents } from "../signalConnection/actions"; | ||
import { randomSignalClient, randomLocalParticipant } from "../../../__mocks__/appMocks"; | ||
|
||
describe("localParticipantSlice", () => { | ||
describe("reducers", () => { | ||
describe("signalEvents.roomJoined", () => { | ||
it("should update state", () => { | ||
const localClient = randomSignalClient({ role: { roleName: "visitor" }, breakoutGroup: "a" }); | ||
const remoteClient = randomSignalClient(); | ||
|
||
const localParticipant = randomLocalParticipant({ | ||
id: localClient.id, | ||
roleName: "viewer", | ||
breakoutGroup: "b", | ||
}); | ||
|
||
const result = localParticipantSlice.reducer( | ||
undefined, | ||
signalEvents.roomJoined({ | ||
...localParticipant, | ||
isLocked: false, | ||
selfId: localClient.id, | ||
room: { | ||
clients: [remoteClient, localClient], | ||
knockers: [], | ||
spotlights: [], | ||
session: null, | ||
}, | ||
}), | ||
); | ||
|
||
expect(result).toEqual({ | ||
...localParticipant, | ||
id: localParticipant.id, | ||
displayName: "", // not set from roomJoined event | ||
roleName: localClient.role.roleName, | ||
breakoutGroup: localClient.breakoutGroup, | ||
clientClaim: localParticipant.clientClaim, | ||
}); | ||
}); | ||
}); | ||
|
||
describe("signalEvents.breakoutGroupJoined", () => { | ||
it("should update the participant", () => { | ||
const breakoutGroupId = "test_breakout_group"; | ||
const participant = randomLocalParticipant(); | ||
const state = { ...participant }; | ||
|
||
const result = localParticipantSlice.reducer( | ||
state, | ||
signalEvents.breakoutGroupJoined({ | ||
clientId: participant.id, | ||
group: breakoutGroupId, | ||
}), | ||
); | ||
|
||
expect(result).toEqual({ | ||
...participant, | ||
breakoutGroup: breakoutGroupId, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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
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
Oops, something went wrong.