Add ESLint Jest (#10261)
This commit is contained in:
@@ -74,7 +74,8 @@ describe("AutoRageshakeStore", () => {
|
||||
});
|
||||
|
||||
it("should send a rageshake", () => {
|
||||
expect(mocked(client).sendToDevice.mock.calls).toMatchInlineSnapshot(`
|
||||
expect(mocked(client).sendToDevice.mock.calls).toMatchInlineSnapshot(
|
||||
`
|
||||
[
|
||||
[
|
||||
"im.vector.auto_rs_request",
|
||||
@@ -82,7 +83,7 @@ describe("AutoRageshakeStore", () => {
|
||||
"@userId:matrix.org": {
|
||||
"undefined": {
|
||||
"device_id": undefined,
|
||||
"event_id": "${utdEvent.getId()}",
|
||||
"event_id": "utd_event_id",
|
||||
"recipient_rageshake": undefined,
|
||||
"room_id": "!room:example.com",
|
||||
"sender_key": undefined,
|
||||
@@ -93,7 +94,8 @@ describe("AutoRageshakeStore", () => {
|
||||
},
|
||||
],
|
||||
]
|
||||
`);
|
||||
`.replace("utd_event_id", utdEvent.getId()!),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1179,34 +1179,34 @@ describe("SpaceStore", () => {
|
||||
const fn = jest.fn();
|
||||
store.traverseSpace("!b:server", fn);
|
||||
|
||||
expect(fn).toBeCalledTimes(3);
|
||||
expect(fn).toBeCalledWith("!a:server");
|
||||
expect(fn).toBeCalledWith("!b:server");
|
||||
expect(fn).toBeCalledWith("!c:server");
|
||||
expect(fn).toHaveBeenCalledTimes(3);
|
||||
expect(fn).toHaveBeenCalledWith("!a:server");
|
||||
expect(fn).toHaveBeenCalledWith("!b:server");
|
||||
expect(fn).toHaveBeenCalledWith("!c:server");
|
||||
});
|
||||
|
||||
it("including rooms", () => {
|
||||
const fn = jest.fn();
|
||||
store.traverseSpace("!b:server", fn, true);
|
||||
|
||||
expect(fn).toBeCalledTimes(8); // twice for shared-child
|
||||
expect(fn).toBeCalledWith("!a:server");
|
||||
expect(fn).toBeCalledWith("!a-child:server");
|
||||
expect(fn).toBeCalledWith("!b:server");
|
||||
expect(fn).toBeCalledWith("!b-child:server");
|
||||
expect(fn).toBeCalledWith("!c:server");
|
||||
expect(fn).toBeCalledWith("!c-child:server");
|
||||
expect(fn).toBeCalledWith("!shared-child:server");
|
||||
expect(fn).toHaveBeenCalledTimes(8); // twice for shared-child
|
||||
expect(fn).toHaveBeenCalledWith("!a:server");
|
||||
expect(fn).toHaveBeenCalledWith("!a-child:server");
|
||||
expect(fn).toHaveBeenCalledWith("!b:server");
|
||||
expect(fn).toHaveBeenCalledWith("!b-child:server");
|
||||
expect(fn).toHaveBeenCalledWith("!c:server");
|
||||
expect(fn).toHaveBeenCalledWith("!c-child:server");
|
||||
expect(fn).toHaveBeenCalledWith("!shared-child:server");
|
||||
});
|
||||
|
||||
it("excluding rooms", () => {
|
||||
const fn = jest.fn();
|
||||
store.traverseSpace("!b:server", fn, false);
|
||||
|
||||
expect(fn).toBeCalledTimes(3);
|
||||
expect(fn).toBeCalledWith("!a:server");
|
||||
expect(fn).toBeCalledWith("!b:server");
|
||||
expect(fn).toBeCalledWith("!c:server");
|
||||
expect(fn).toHaveBeenCalledTimes(3);
|
||||
expect(fn).toHaveBeenCalledWith("!a:server");
|
||||
expect(fn).toHaveBeenCalledWith("!b:server");
|
||||
expect(fn).toHaveBeenCalledWith("!c:server");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -163,13 +163,13 @@ describe("SlidingRoomListStore", () => {
|
||||
it("setTagSorting alters the 'sort' option in the list", async () => {
|
||||
const tagId: TagID = "foo";
|
||||
await store.setTagSorting(tagId, SortAlgorithm.Alphabetic);
|
||||
expect(context._SlidingSyncManager!.ensureListRegistered).toBeCalledWith(tagId, {
|
||||
expect(context._SlidingSyncManager!.ensureListRegistered).toHaveBeenCalledWith(tagId, {
|
||||
sort: SlidingSyncSortToFilter[SortAlgorithm.Alphabetic],
|
||||
});
|
||||
expect(store.getTagSorting(tagId)).toEqual(SortAlgorithm.Alphabetic);
|
||||
|
||||
await store.setTagSorting(tagId, SortAlgorithm.Recent);
|
||||
expect(context._SlidingSyncManager!.ensureListRegistered).toBeCalledWith(tagId, {
|
||||
expect(context._SlidingSyncManager!.ensureListRegistered).toHaveBeenCalledWith(tagId, {
|
||||
sort: SlidingSyncSortToFilter[SortAlgorithm.Recent],
|
||||
});
|
||||
expect(store.getTagSorting(tagId)).toEqual(SortAlgorithm.Recent);
|
||||
|
||||
@@ -151,7 +151,7 @@ describe("StopGapWidgetDriver", () => {
|
||||
state: OpenIDRequestState.Allowed,
|
||||
token: await client.getOpenIdToken(),
|
||||
};
|
||||
expect(listener).toBeCalledWith(openIdUpdate);
|
||||
expect(listener).toHaveBeenCalledWith(openIdUpdate);
|
||||
});
|
||||
|
||||
describe("sendToDevice", () => {
|
||||
@@ -276,7 +276,7 @@ describe("StopGapWidgetDriver", () => {
|
||||
prevBatch: undefined,
|
||||
});
|
||||
|
||||
expect(client.relations).toBeCalledWith("!this-room-id", "$event", null, null, {});
|
||||
expect(client.relations).toHaveBeenCalledWith("!this-room-id", "$event", null, null, {});
|
||||
});
|
||||
|
||||
it("reads related events from a selected room", async () => {
|
||||
@@ -292,7 +292,7 @@ describe("StopGapWidgetDriver", () => {
|
||||
prevBatch: undefined,
|
||||
});
|
||||
|
||||
expect(client.relations).toBeCalledWith("!room-id", "$event", null, null, {});
|
||||
expect(client.relations).toHaveBeenCalledWith("!room-id", "$event", null, null, {});
|
||||
});
|
||||
|
||||
it("reads related events with custom parameters", async () => {
|
||||
@@ -318,7 +318,7 @@ describe("StopGapWidgetDriver", () => {
|
||||
prevBatch: undefined,
|
||||
});
|
||||
|
||||
expect(client.relations).toBeCalledWith("!room-id", "$event", "m.reference", "m.room.message", {
|
||||
expect(client.relations).toHaveBeenCalledWith("!room-id", "$event", "m.reference", "m.room.message", {
|
||||
limit: 25,
|
||||
from: "from-token",
|
||||
to: "to-token",
|
||||
|
||||
Reference in New Issue
Block a user