You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-05 00:42:10 +03:00
some tests for room.guessDMUserId()
This commit is contained in:
@@ -1411,4 +1411,27 @@ describe("Room", function() {
|
|||||||
expect(room.getMyMembership()).toEqual("join");
|
expect(room.getMyMembership()).toEqual("join");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("guessDMUserId", function() {
|
||||||
|
it("should return first hero id",
|
||||||
|
async function() {
|
||||||
|
const room = new Room(roomId, null, userA);
|
||||||
|
room.setSummary({'m.heroes': [userB]});
|
||||||
|
expect(room.guessDMUserId()).toEqual(userB);
|
||||||
|
});
|
||||||
|
it("should return first member that isn't self",
|
||||||
|
async function() {
|
||||||
|
const room = new Room(roomId, null, userA);
|
||||||
|
room.addLiveEvents([utils.mkMembership({
|
||||||
|
user: userB, mship: "join",
|
||||||
|
room: roomId, event: true,
|
||||||
|
})]);
|
||||||
|
expect(room.guessDMUserId()).toEqual(userB);
|
||||||
|
});
|
||||||
|
it("should return self if only member present",
|
||||||
|
async function() {
|
||||||
|
const room = new Room(roomId, null, userA);
|
||||||
|
expect(room.guessDMUserId()).toEqual(userA);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user