You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Add thread notification with server assistance (MSC3773) (#9400)
Co-authored-by: Janne Mareike Koschinski <janne@kuschku.de>
This commit is contained in:
@ -15,7 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { MatrixEventEvent, MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { MatrixEventEvent, MatrixEvent, MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { stubClient } from "../../test-utils";
|
||||
import { MatrixClientPeg } from "../../../src/MatrixClientPeg";
|
||||
@ -24,12 +24,16 @@ import * as testUtils from "../../test-utils";
|
||||
import { NotificationStateEvents } from "../../../src/stores/notifications/NotificationState";
|
||||
|
||||
describe("RoomNotificationState", () => {
|
||||
stubClient();
|
||||
const client = MatrixClientPeg.get();
|
||||
let testRoom: Room;
|
||||
let client: MatrixClient;
|
||||
|
||||
beforeEach(() => {
|
||||
stubClient();
|
||||
client = MatrixClientPeg.get();
|
||||
testRoom = testUtils.mkStubRoom("$aroomid", "Test room", client);
|
||||
});
|
||||
|
||||
it("Updates on event decryption", () => {
|
||||
const testRoom = testUtils.mkStubRoom("$aroomid", "Test room", client);
|
||||
|
||||
const roomNotifState = new RoomNotificationState(testRoom as any as Room);
|
||||
const listener = jest.fn();
|
||||
roomNotifState.addListener(NotificationStateEvents.Update, listener);
|
||||
@ -40,4 +44,9 @@ describe("RoomNotificationState", () => {
|
||||
client.emit(MatrixEventEvent.Decrypted, testEvent);
|
||||
expect(listener).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("removes listeners", () => {
|
||||
const roomNotifState = new RoomNotificationState(testRoom as any as Room);
|
||||
expect(() => roomNotifState.destroy()).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user