You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-07 21:23:00 +03:00
Resilience fix for homeserver without thread notification support (#9565)
* Notification state resilience * TypeScript strict fixes * Add tests
This commit is contained in:
@@ -16,6 +16,7 @@ limitations under the License.
|
||||
|
||||
import { render } from "@testing-library/react";
|
||||
import { MatrixClient, PendingEventOrdering } from "matrix-js-sdk/src/client";
|
||||
import { Feature, ServerSupport } from "matrix-js-sdk/src/feature";
|
||||
import { NotificationCountType, Room } from "matrix-js-sdk/src/models/room";
|
||||
import React from "react";
|
||||
|
||||
@@ -34,7 +35,7 @@ describe("RoomHeaderButtons-test.tsx", function() {
|
||||
|
||||
stubClient();
|
||||
client = MatrixClientPeg.get();
|
||||
room = new Room(ROOM_ID, client, client.getUserId(), {
|
||||
room = new Room(ROOM_ID, client, client.getUserId() ?? "", {
|
||||
pendingEventOrdering: PendingEventOrdering.Detached,
|
||||
});
|
||||
|
||||
@@ -43,7 +44,7 @@ describe("RoomHeaderButtons-test.tsx", function() {
|
||||
});
|
||||
});
|
||||
|
||||
function getComponent(room: Room) {
|
||||
function getComponent(room?: Room) {
|
||||
return render(<RoomHeaderButtons
|
||||
room={room}
|
||||
excludedRightPanelPhaseButtons={[]}
|
||||
@@ -94,4 +95,9 @@ describe("RoomHeaderButtons-test.tsx", function() {
|
||||
|
||||
expect(container.querySelector(".mx_RightPanel_threadsButton .mx_Indicator")).toBeNull();
|
||||
});
|
||||
|
||||
it("does not explode without a room", () => {
|
||||
client.canSupport.set(Feature.ThreadUnreadNotifications, ServerSupport.Unsupported);
|
||||
expect(() => getComponent()).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user