Skip to content

Commit 7142ca3

Browse files
committed
test(room list item): update tests
1 parent fbf4773 commit 7142ca3

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

test/unit-tests/components/views/rooms/RoomListPanel/RoomListItemView-test.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,32 @@ import {
1818
type RoomListItemViewState,
1919
useRoomListItemViewModel,
2020
} from "../../../../../../src/components/viewmodels/roomlist/RoomListItemViewModel";
21+
import { RoomNotificationState } from "../../../../../../src/stores/notifications/RoomNotificationState";
2122

2223
jest.mock("../../../../../../src/components/viewmodels/roomlist/RoomListItemViewModel", () => ({
2324
useRoomListItemViewModel: jest.fn(),
2425
}));
2526

2627
describe("<RoomListItemView />", () => {
27-
const defaultValue: RoomListItemViewState = {
28-
openRoom: jest.fn(),
29-
showHoverMenu: false,
30-
};
28+
let defaultValue: RoomListItemViewState;
3129
let matrixClient: MatrixClient;
3230
let room: Room;
3331

3432
beforeEach(() => {
35-
mocked(useRoomListItemViewModel).mockReturnValue(defaultValue);
3633
matrixClient = stubClient();
3734
room = mkRoom(matrixClient, "room1");
3835

3936
DMRoomMap.makeShared(matrixClient);
4037
jest.spyOn(DMRoomMap.shared(), "getUserIdForRoomId").mockReturnValue(null);
38+
39+
defaultValue = {
40+
openRoom: jest.fn(),
41+
showHoverMenu: false,
42+
notificationState: new RoomNotificationState(room, false),
43+
a11yLabel: "Open room room1",
44+
};
45+
46+
mocked(useRoomListItemViewModel).mockReturnValue(defaultValue);
4147
});
4248

4349
test("should render a room item", () => {

0 commit comments

Comments
 (0)