Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Remove tests for unstable MSC3882
Browse files Browse the repository at this point in the history
  • Loading branch information
hughns committed Sep 28, 2023
1 parent 8bf92c3 commit 49a492b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 132 deletions.
3 changes: 1 addition & 2 deletions test/components/views/settings/devices/LoginWithQR-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ describe("<LoginWithQR />", () => {
jest.spyOn(MSC3906Rendezvous.prototype, "verifyNewDeviceOnExistingDevice").mockResolvedValue(undefined);
client.requestLoginToken.mockResolvedValue({
login_token: "token",
expires_in: 1000, // this is as per MSC3882 r0
expires_in_ms: 1000 * 1000, // this is as per MSC3882 r1
expires_in_ms: 1000 * 1000,
} as LoginTokenPostResponse); // we force the type here so that it works with versions of js-sdk that don't have r1 support yet
});

Expand Down
48 changes: 0 additions & 48 deletions test/components/views/settings/devices/LoginWithQRSection-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ function makeVersions(unstableFeatures: Record<string, boolean>): IServerVersion
};
}

const unstableName = GET_LOGIN_TOKEN_CAPABILITY.altName as string;

describe("<LoginWithQRSection />", () => {
beforeAll(() => {
jest.spyOn(MatrixClientPeg, "get").mockReturnValue(makeClient({}));
Expand All @@ -69,33 +67,13 @@ describe("<LoginWithQRSection />", () => {
expect(container).toMatchSnapshot();
});

it("only MSC3882 r0 enabled", async () => {
const { container } = render(getComponent({ versions: makeVersions({ "org.matrix.msc3882": true }) }));
expect(container).toMatchSnapshot();
});

it("only MSC3882 r1 enabled", async () => {
const { container } = render(getComponent({ capabilities: { [unstableName]: { enabled: true } } }));
expect(container).toMatchSnapshot();
});

it("only get_login_token enabled", async () => {
const { container } = render(
getComponent({ capabilities: { [GET_LOGIN_TOKEN_CAPABILITY.name]: { enabled: true } } }),
);
expect(container).toMatchSnapshot();
});

it("MSC3886 + MSC3882 r1 disabled", async () => {
const { container } = render(
getComponent({
versions: makeVersions({ "org.matrix.msc3886": true }),
capabilities: { [unstableName]: { enabled: false } },
}),
);
expect(container).toMatchSnapshot();
});

it("MSC3886 + get_login_token disabled", async () => {
const { container } = render(
getComponent({
Expand All @@ -108,32 +86,6 @@ describe("<LoginWithQRSection />", () => {
});

describe("should render panel", () => {
it("MSC3882 r0 + MSC3886", async () => {
const { container } = render(
getComponent({
versions: makeVersions({
"org.matrix.msc3882": true,
"org.matrix.msc3886": true,
}),
}),
);
expect(container).toMatchSnapshot();
});

it("MSC3882 r1 + MSC3886", async () => {
const { container } = render(
getComponent({
versions: makeVersions({
"org.matrix.msc3886": true,
}),
capabilities: {
[unstableName]: { enabled: true },
},
}),
);
expect(container).toMatchSnapshot();
});

it("get_login_token + MSC3886", async () => {
const { container } = render(
getComponent({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,93 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<LoginWithQRSection /> should not render MSC3886 + MSC3882 r1 disabled 1`] = `<div />`;

exports[`<LoginWithQRSection /> should not render MSC3886 + get_login_token disabled 1`] = `<div />`;

exports[`<LoginWithQRSection /> should not render no support at all 1`] = `<div />`;

exports[`<LoginWithQRSection /> should not render only MSC3882 r0 enabled 1`] = `<div />`;

exports[`<LoginWithQRSection /> should not render only MSC3882 r1 enabled 1`] = `<div />`;

exports[`<LoginWithQRSection /> should not render only get_login_token enabled 1`] = `<div />`;

exports[`<LoginWithQRSection /> should render panel MSC3882 r0 + MSC3886 1`] = `
<div>
<div
class="mx_SettingsSubsection"
>
<div
class="mx_SettingsSubsectionHeading"
>
<h3
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
>
Sign in with QR code
</h3>
</div>
<div
class="mx_SettingsSubsection_content"
>
<div
class="mx_LoginWithQRSection"
>
<p
class="mx_SettingsTab_subsectionText"
>
You can use this device to sign in a new device with a QR code. You will need to scan the QR code shown on this device with your device that's signed out.
</p>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary"
role="button"
tabindex="0"
>
Show QR code
</div>
</div>
</div>
</div>
</div>
`;

exports[`<LoginWithQRSection /> should render panel MSC3882 r1 + MSC3886 1`] = `
<div>
<div
class="mx_SettingsSubsection"
>
<div
class="mx_SettingsSubsectionHeading"
>
<h3
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
>
Sign in with QR code
</h3>
</div>
<div
class="mx_SettingsSubsection_content"
>
<div
class="mx_LoginWithQRSection"
>
<p
class="mx_SettingsTab_subsectionText"
>
You can use this device to sign in a new device with a QR code. You will need to scan the QR code shown on this device with your device that's signed out.
</p>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary"
role="button"
tabindex="0"
>
Show QR code
</div>
</div>
</div>
</div>
</div>
`;

exports[`<LoginWithQRSection /> should render panel get_login_token + MSC3886 1`] = `
<div>
<div
Expand Down

0 comments on commit 49a492b

Please sign in to comment.