diff --git a/spec/unit/matrix-client.spec.ts b/spec/unit/matrix-client.spec.ts index ce073aa7a..19c8f176c 100644 --- a/spec/unit/matrix-client.spec.ts +++ b/spec/unit/matrix-client.spec.ts @@ -68,9 +68,9 @@ jest.mock("../../src/webrtc/call", () => ({ supportsMatrixCall: jest.fn(() => false), })); -// Utility function to ease the transition from our QueryDict type to a string record -// which we can use to stringify with URLSearchParams -function convertQueryDictToStringRecord(queryDict?: QueryDict): Map { +// Utility function to ease the transition from our QueryDict type to a Map +// which we can use to build a URLSearchParams +function convertQueryDictToMap(queryDict?: QueryDict): Map { if (!queryDict) { return new Map(); } @@ -100,15 +100,15 @@ type WrappedRoom = Room & { describe("convertQueryDictToStringRecord", () => { it("returns an empty map when dict is undefined", () => { - expect(convertQueryDictToStringRecord(undefined)).toEqual(new Map()); + expect(convertQueryDictToMap(undefined)).toEqual(new Map()); }); it("converts an empty QueryDict to an empty map", () => { - expect(convertQueryDictToStringRecord({})).toEqual(new Map()); + expect(convertQueryDictToMap({})).toEqual(new Map()); }); it("converts a QueryDict of strings to the equivalent map", () => { - expect(convertQueryDictToStringRecord({ a: "b", c: "d" })).toEqual( + expect(convertQueryDictToMap({ a: "b", c: "d" })).toEqual( new Map([ ["a", "b"], ["c", "d"], @@ -117,7 +117,7 @@ describe("convertQueryDictToStringRecord", () => { }); it("converts the values of the supplied QueryDict to strings", () => { - expect(convertQueryDictToStringRecord({ arr: ["b", "c"], num: 45, boo: true, und: undefined })).toEqual( + expect(convertQueryDictToMap({ arr: ["b", "c"], num: 45, boo: true, und: undefined })).toEqual( new Map([ ["arr", "b,c"], ["num", "45"], @@ -128,7 +128,7 @@ describe("convertQueryDictToStringRecord", () => { }); it("produces sane URLSearchParams conversions", () => { - expect(new URLSearchParams(Array.from(convertQueryDictToStringRecord({ a: "b", c: "d" }))).toString()).toEqual( + expect(new URLSearchParams(Array.from(convertQueryDictToMap({ a: "b", c: "d" }))).toString()).toEqual( "a=b&c=d", ); }); @@ -255,11 +255,11 @@ describe("MatrixClient", function () { } const receivedRequestQueryString = new URLSearchParams( - Array.from(convertQueryDictToStringRecord(queryParams)), + Array.from(convertQueryDictToMap(queryParams)), ).toString(); const receivedRequestDebugString = `${method} ${prefix}${path}${receivedRequestQueryString}`; const expectedQueryString = new URLSearchParams( - Array.from(convertQueryDictToStringRecord(next.expectQueryParams)), + Array.from(convertQueryDictToMap(next.expectQueryParams)), ).toString(); const expectedRequestDebugString = `${next.method} ${next.prefix ?? ""}${next.path}${expectedQueryString}`; // If you're seeing this then you forgot to handle at least 1 pending request.