mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Add some explanation comments.
This commit is contained in:
@@ -26,6 +26,13 @@ import { randomUUID } from "crypto";
|
||||
|
||||
import { ReactionsProvider, useReactions } from "./useReactions";
|
||||
|
||||
/**
|
||||
* Test explanation.
|
||||
* This test suite checks that the useReactions hook appropriately reacts
|
||||
* to new reactions, redactions and membership changesin the room. There is
|
||||
* a large amount of test structure used to construct a mock environment.
|
||||
*/
|
||||
|
||||
const memberUserIdAlice = "@alice:example.org";
|
||||
const memberEventAlice = "$membership-alice:example.org";
|
||||
const memberUserIdBob = "@bob:example.org";
|
||||
@@ -198,7 +205,7 @@ describe("useReactions", () => {
|
||||
rerender(<TestComponentWrapper rtcSession={rtcSession} />);
|
||||
expect(queryByRole("list")?.children).to.have.lengthOf(0);
|
||||
});
|
||||
test("handles loading events from cold", () => {
|
||||
test("handles loading prior raised hand events", () => {
|
||||
const room = new MockRoom([createReaction(memberEventAlice)]);
|
||||
const rtcSession = new MockRTCSession(room);
|
||||
const { queryByRole } = render(
|
||||
@@ -206,6 +213,8 @@ describe("useReactions", () => {
|
||||
);
|
||||
expect(queryByRole("list")?.children).to.have.lengthOf(1);
|
||||
});
|
||||
// If the membership event changes for a user, we want to remove
|
||||
// the raised hand event.
|
||||
test("will remove reaction when a member leaves the call", () => {
|
||||
const room = new MockRoom([createReaction(memberEventAlice)]);
|
||||
const rtcSession = new MockRTCSession(room);
|
||||
@@ -224,6 +233,7 @@ describe("useReactions", () => {
|
||||
<TestComponentWrapper rtcSession={rtcSession} />,
|
||||
);
|
||||
expect(queryByRole("list")?.children).to.have.lengthOf(1);
|
||||
// Simulate leaving and rejoining
|
||||
rtcSession.testRemoveMember(memberUserIdAlice);
|
||||
rtcSession.testAddMember(memberUserIdAlice);
|
||||
rerender(<TestComponentWrapper rtcSession={rtcSession} />);
|
||||
|
||||
Reference in New Issue
Block a user