Add thread notification with server assistance (MSC3773) (#9400)
Co-authored-by: Janne Mareike Koschinski <janne@kuschku.de>
This commit is contained in:
parent
d4f1c573ad
commit
9eb4f8d723
22 changed files with 1014 additions and 142 deletions
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue