mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-04 01:19:41 +00:00
Merge remote-tracking branch 'origin/develop' into dbkr/refactor_createcrosssigningdialog
This commit is contained in:
@@ -22,7 +22,7 @@ import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { OidcError } from "matrix-js-sdk/src/oidc/error";
|
||||
import { BearerTokenResponse } from "matrix-js-sdk/src/oidc/validate";
|
||||
import { defer, IDeferred, sleep } from "matrix-js-sdk/src/utils";
|
||||
import { UserVerificationStatus } from "matrix-js-sdk/src/crypto-api";
|
||||
import { CryptoEvent, UserVerificationStatus } from "matrix-js-sdk/src/crypto-api";
|
||||
|
||||
import MatrixChat from "../../../../src/components/structures/MatrixChat";
|
||||
import * as StorageAccess from "../../../../src/utils/StorageAccess";
|
||||
@@ -137,6 +137,7 @@ describe("<MatrixChat />", () => {
|
||||
userHasCrossSigningKeys: jest.fn(),
|
||||
// This needs to not finish immediately because we need to test the screen appears
|
||||
bootstrapCrossSigning: jest.fn().mockImplementation(() => bootstrapDeferred.promise),
|
||||
getActiveSessionBackupVersion: jest.fn().mockResolvedValue(null),
|
||||
}),
|
||||
secretStorage: {
|
||||
isStored: jest.fn().mockReturnValue(null),
|
||||
@@ -1515,4 +1516,22 @@ describe("<MatrixChat />", () => {
|
||||
expect(screen.getByTestId("mobile-register")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("when key backup failed", () => {
|
||||
it("should show the new recovery method dialog", async () => {
|
||||
jest.mock("../../../../src/async-components/views/dialogs/security/NewRecoveryMethodDialog", () => ({
|
||||
__esModule: true,
|
||||
default: () => <span>mocked dialog</span>,
|
||||
}));
|
||||
jest.spyOn(mockClient.getCrypto()!, "getActiveSessionBackupVersion").mockResolvedValue("version");
|
||||
|
||||
getComponent({});
|
||||
defaultDispatcher.dispatch({
|
||||
action: "will_start_client",
|
||||
});
|
||||
await flushPromises();
|
||||
mockClient.emit(CryptoEvent.KeyBackupFailed, "error code");
|
||||
await waitFor(() => expect(screen.getByText("mocked dialog")).toBeInTheDocument());
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,7 +10,10 @@ import React from "react";
|
||||
import fetchMock from "fetch-mock-jest";
|
||||
import { render, screen, waitForElementToBeRemoved } from "jest-matrix-react";
|
||||
|
||||
import ChangelogDialog from "../../../../../src/components/views/dialogs/ChangelogDialog";
|
||||
import ChangelogDialog, {
|
||||
DevelopVersionString,
|
||||
parseVersion,
|
||||
} from "../../../../../src/components/views/dialogs/ChangelogDialog";
|
||||
|
||||
describe("<ChangelogDialog />", () => {
|
||||
it("should fetch github proxy url for each repo with old and new version strings", async () => {
|
||||
@@ -64,8 +67,8 @@ describe("<ChangelogDialog />", () => {
|
||||
files: [],
|
||||
});
|
||||
|
||||
const newVersion = "newsha1-js-newsha3";
|
||||
const oldVersion = "oldsha1-js-oldsha3";
|
||||
const newVersion = "newsha1-js-newsha3" as DevelopVersionString;
|
||||
const oldVersion = "oldsha1-js-oldsha3" as DevelopVersionString;
|
||||
const { asFragment } = render(
|
||||
<ChangelogDialog newVersion={newVersion} version={oldVersion} onFinished={jest.fn()} />,
|
||||
);
|
||||
@@ -78,3 +81,24 @@ describe("<ChangelogDialog />", () => {
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseVersion", () => {
|
||||
it("should return null for old-style version strings", () => {
|
||||
expect(parseVersion("aaaabbbb-react-ccccdddd-js-eeeeffff")).toBeNull();
|
||||
});
|
||||
|
||||
it("should return null for invalid version strings", () => {
|
||||
expect(parseVersion("aaaabbbb-react-ccccdddd")).toBeNull();
|
||||
});
|
||||
|
||||
it("should return null for release version strings", () => {
|
||||
expect(parseVersion("v1.22.33")).toBeNull();
|
||||
});
|
||||
|
||||
it("should return mapping for develop version string", () => {
|
||||
expect(parseVersion("aaaabbbb-js-eeeeffff")).toEqual({
|
||||
"element-hq/element-web": "aaaabbbb",
|
||||
"matrix-org/matrix-js-sdk": "eeeeffff",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user