Use stable get_login_token and remove unstable MSC3882 support (#11001)

* Support for stable MSC3882 get_login_token

* Fix unstable name type

* Remove tests for unstable MSC3882

* Fix up tests
This commit is contained in:
Hugh Nimmo-Smith 2023-10-03 13:15:41 +01:00 committed by GitHub
parent 0ab51bc59d
commit 4fd8ab933a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 81 deletions

View file

@ -16,7 +16,7 @@ limitations under the License.
import { render } from "@testing-library/react";
import { mocked } from "jest-mock";
import { IClientWellKnown, IServerVersions, MatrixClient, UNSTABLE_MSC3882_CAPABILITY } from "matrix-js-sdk/src/matrix";
import { IClientWellKnown, IServerVersions, MatrixClient, GET_LOGIN_TOKEN_CAPABILITY } from "matrix-js-sdk/src/matrix";
import React from "react";
import LoginWithQRSection from "../../../../../src/components/views/settings/devices/LoginWithQRSection";
@ -67,23 +67,18 @@ describe("<LoginWithQRSection />", () => {
expect(container).toMatchSnapshot();
});
it("only MSC3882 enabled", async () => {
const { container } = render(getComponent({ versions: makeVersions({ "org.matrix.msc3882": true }) }));
expect(container).toMatchSnapshot();
});
it("only MSC3882 r1 enabled", async () => {
it("only get_login_token enabled", async () => {
const { container } = render(
getComponent({ capabilities: { [UNSTABLE_MSC3882_CAPABILITY.name]: { enabled: true } } }),
getComponent({ capabilities: { [GET_LOGIN_TOKEN_CAPABILITY.name]: { enabled: true } } }),
);
expect(container).toMatchSnapshot();
});
it("MSC3886 + MSC3882 r1 disabled", async () => {
it("MSC3886 + get_login_token disabled", async () => {
const { container } = render(
getComponent({
versions: makeVersions({ "org.matrix.msc3886": true }),
capabilities: { [UNSTABLE_MSC3882_CAPABILITY.name]: { enabled: false } },
capabilities: { [GET_LOGIN_TOKEN_CAPABILITY.name]: { enabled: false } },
}),
);
expect(container).toMatchSnapshot();
@ -91,33 +86,21 @@ describe("<LoginWithQRSection />", () => {
});
describe("should render panel", () => {
it("MSC3882 + MSC3886", async () => {
const { container } = render(
getComponent({
versions: makeVersions({
"org.matrix.msc3882": true,
"org.matrix.msc3886": true,
}),
}),
);
expect(container).toMatchSnapshot();
});
it("MSC3882 r1 + MSC3886", async () => {
it("get_login_token + MSC3886", async () => {
const { container } = render(
getComponent({
versions: makeVersions({
"org.matrix.msc3886": true,
}),
capabilities: {
[UNSTABLE_MSC3882_CAPABILITY.name]: { enabled: true },
[GET_LOGIN_TOKEN_CAPABILITY.name]: { enabled: true },
},
}),
);
expect(container).toMatchSnapshot();
});
it("MSC3882 r1 + .well-known", async () => {
it("get_login_token + .well-known", async () => {
const wellKnown = {
"io.element.rendezvous": {
server: "https://rz.local",
@ -127,7 +110,7 @@ describe("<LoginWithQRSection />", () => {
const { container } = render(
getComponent({
versions: makeVersions({}),
capabilities: { [UNSTABLE_MSC3882_CAPABILITY.name]: { enabled: true } },
capabilities: { [GET_LOGIN_TOKEN_CAPABILITY.name]: { enabled: true } },
wellKnown,
}),
);