1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00
Eric Eastwood
2022-12-13 16:37:47 -06:00
parent 70a033c2fd
commit a0aa5074ed

View File

@ -336,7 +336,8 @@ describe("MatrixClient", function () {
await client.timestampToEvent(roomId, 0, Direction.Forward);
expect(mocked(client.http.authedRequest).mock.calls.length).toStrictEqual(1);
const [method, path, queryParams, , { prefix }] = mocked(client.http.authedRequest).mock.calls[0];
const [method, path, queryParams, , { prefix } = { prefix: undefined }] = mocked(client.http.authedRequest)
.mock.calls[0];
expect(method).toStrictEqual("GET");
expect(prefix).toStrictEqual(ClientPrefix.V1);
expect(path).toStrictEqual(`/rooms/${encodeURIComponent(roomId)}/timestamp_to_event`);
@ -376,9 +377,8 @@ describe("MatrixClient", function () {
await client.timestampToEvent(roomId, 0, Direction.Forward);
expect(mocked(client.http.authedRequest).mock.calls.length).toStrictEqual(2);
const [stableMethod, stablePath, stableQueryParams, , { prefix: stablePrefix }] = mocked(
client.http.authedRequest,
).mock.calls[0];
const [stableMethod, stablePath, stableQueryParams, , { prefix: stablePrefix } = { prefix: undefined }] =
mocked(client.http.authedRequest).mock.calls[0];
expect(stableMethod).toStrictEqual("GET");
expect(stablePrefix).toStrictEqual(ClientPrefix.V1);
expect(stablePath).toStrictEqual(`/rooms/${encodeURIComponent(roomId)}/timestamp_to_event`);
@ -387,9 +387,13 @@ describe("MatrixClient", function () {
dir: "f",
});
const [unstableMethod, unstablePath, unstableQueryParams, , { prefix: unstablePrefix }] = mocked(
client.http.authedRequest,
).mock.calls[1];
const [
unstableMethod,
unstablePath,
unstableQueryParams,
,
{ prefix: unstablePrefix } = { prefix: undefined },
] = mocked(client.http.authedRequest).mock.calls[1];
expect(unstableMethod).toStrictEqual("GET");
expect(unstablePrefix).toStrictEqual(unstableMSC3030Prefix);
expect(unstablePath).toStrictEqual(`/rooms/${encodeURIComponent(roomId)}/timestamp_to_event`);
@ -419,7 +423,8 @@ describe("MatrixClient", function () {
await expect(client.timestampToEvent(roomId, 0, Direction.Forward)).rejects.toBeDefined();
expect(mocked(client.http.authedRequest).mock.calls.length).toStrictEqual(1);
const [method, path, queryParams, , { prefix }] = mocked(client.http.authedRequest).mock.calls[0];
const [method, path, queryParams, , { prefix } = { prefix: undefined }] = mocked(client.http.authedRequest)
.mock.calls[0];
expect(method).toStrictEqual("GET");
expect(prefix).toStrictEqual(ClientPrefix.V1);
expect(path).toStrictEqual(`/rooms/${encodeURIComponent(roomId)}/timestamp_to_event`);