Merge branch 'develop' into t3chguy/fix/20721

This commit is contained in:
Michael Telatynski 2024-12-02 09:22:51 +00:00 committed by GitHub
commit 351774d3e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 34 additions and 72 deletions

View file

@ -11,8 +11,6 @@ import fetchMockJest from "fetch-mock-jest";
import { advanceDateAndTime, stubClient } from "../test-utils";
import { IMatrixClientPeg, MatrixClientPeg as peg } from "../../src/MatrixClientPeg";
import SettingsStore from "../../src/settings/SettingsStore";
import { SettingLevel } from "../../src/settings/SettingLevel";
jest.useFakeTimers();
@ -81,27 +79,18 @@ describe("MatrixClientPeg", () => {
});
it("should initialise the rust crypto library by default", async () => {
const mockSetValue = jest.spyOn(SettingsStore, "setValue").mockResolvedValue(undefined);
const mockInitRustCrypto = jest.spyOn(testPeg.safeGet(), "initRustCrypto").mockResolvedValue(undefined);
const cryptoStoreKey = new Uint8Array([1, 2, 3, 4]);
await testPeg.start({ rustCryptoStoreKey: cryptoStoreKey });
expect(mockInitRustCrypto).toHaveBeenCalledWith({ storageKey: cryptoStoreKey });
// we should have stashed the setting in the settings store
expect(mockSetValue).toHaveBeenCalledWith("feature_rust_crypto", null, SettingLevel.DEVICE, true);
});
it("Should migrate existing login", async () => {
const mockSetValue = jest.spyOn(SettingsStore, "setValue").mockResolvedValue(undefined);
const mockInitRustCrypto = jest.spyOn(testPeg.safeGet(), "initRustCrypto").mockResolvedValue(undefined);
await testPeg.start();
expect(mockInitRustCrypto).toHaveBeenCalledTimes(1);
// we should have stashed the setting in the settings store
expect(mockSetValue).toHaveBeenCalledWith("feature_rust_crypto", null, SettingLevel.DEVICE, true);
});
});
});

View file

@ -56,7 +56,6 @@ describe("<LoginWithQRSection />", () => {
const defaultProps = {
onShowQr: () => {},
versions: makeVersions({ "org.matrix.msc4108": true }),
wellKnown: {},
};
const getComponent = (props = {}) => <LoginWithQRSection {...defaultProps} {...props} />;