1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-07 23:02:56 +03:00

Implementation of MSC3882 login token request (#2687)

This commit is contained in:
Hugh Nimmo-Smith
2022-09-22 16:36:37 +01:00
committed by GitHub
parent 39bc7e2bb3
commit caadc6f95b
4 changed files with 91 additions and 1 deletions

View File

@@ -1075,6 +1075,29 @@ describe("MatrixClient", function() {
expect(await prom).toStrictEqual(response);
});
});
describe("requestLoginToken", () => {
it("should hit the expected API endpoint with UIA", async () => {
const response = {};
const uiaData = { foo: "baa" };
const prom = client.requestLoginToken(uiaData);
httpBackend
.when("POST", "/unstable/org.matrix.msc3882/login/token", { auth: uiaData })
.respond(200, response);
await httpBackend.flush();
expect(await prom).toStrictEqual(response);
});
it("should hit the expected API endpoint without UIA", async () => {
const response = {};
const prom = client.requestLoginToken();
httpBackend
.when("POST", "/unstable/org.matrix.msc3882/login/token", {})
.respond(200, response);
await httpBackend.flush();
expect(await prom).toStrictEqual(response);
});
});
});
function withThreadId(event, newThreadId) {