Tweak some tests

This commit is contained in:
Michael Telatynski 2021-04-23 12:19:08 +01:00
parent a38419defb
commit a12cefee8e
3 changed files with 7 additions and 8 deletions

View File

@ -45,7 +45,7 @@ export function eventTriggersUnreadCount(ev) {
}
export function doesRoomHaveUnreadMessages(room) {
const myUserId = MatrixClientPeg.get().credentials.userId;
const myUserId = MatrixClientPeg.get().getUserId();
// get the most recent read receipt sent by our account.
// N.B. this is NOT a read marker (RM, aka "read up to marker"),

View File

@ -224,7 +224,7 @@ export function mkStubRoom(roomId = null) {
hasMembershipState: () => null,
getVersion: () => '1',
shouldUpgradeToVersion: () => null,
getMyMembership: () => "join",
getMyMembership: jest.fn().mockReturnValue("join"),
maySendMessage: jest.fn().mockReturnValue(true),
currentState: {
getStateEvents: jest.fn(),
@ -233,11 +233,7 @@ export function mkStubRoom(roomId = null) {
maySendEvent: jest.fn().mockReturnValue(true),
members: [],
},
tags: {
"m.favourite": {
order: 0.5,
},
},
tags: {},
setBlacklistUnverifiedDevices: jest.fn(),
on: jest.fn(),
removeListener: jest.fn(),
@ -245,6 +241,9 @@ export function mkStubRoom(roomId = null) {
getAvatarUrl: () => 'mxc://avatar.url/room.png',
getMxcAvatarUrl: () => 'mxc://avatar.url/room.png',
isSpaceRoom: jest.fn(() => false),
getUnreadNotificationCount: jest.fn(() => 0),
getEventReadUpTo: jest.fn(() => null),
timeline: [],
};
}

View File

@ -128,7 +128,7 @@ describe("shieldStatusForMembership self-trust behaviour", function() {
describe("shieldStatusForMembership other-trust behaviour", function() {
beforeAll(() => {
DMRoomMap._sharedInstance = {
DMRoomMap.sharedInstance = {
getUserIdForRoomId: (roomId) => roomId === "DM" ? "@any:h" : null,
};
});