You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Fix tests
This commit is contained in:
@ -37,7 +37,7 @@ describe("AccessSecretStorageDialog", function() {
|
|||||||
recoveryKey: "a",
|
recoveryKey: "a",
|
||||||
});
|
});
|
||||||
const e = { preventDefault: () => {} };
|
const e = { preventDefault: () => {} };
|
||||||
testInstance.getInstance()._onRecoveryKeyNext(e);
|
testInstance.getInstance().onRecoveryKeyNext(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Considers a valid key to be valid", async function() {
|
it("Considers a valid key to be valid", async function() {
|
||||||
@ -51,9 +51,9 @@ describe("AccessSecretStorageDialog", function() {
|
|||||||
stubClient();
|
stubClient();
|
||||||
MatrixClientPeg.get().keyBackupKeyFromRecoveryKey = () => 'a raw key';
|
MatrixClientPeg.get().keyBackupKeyFromRecoveryKey = () => 'a raw key';
|
||||||
MatrixClientPeg.get().checkSecretStorageKey = () => true;
|
MatrixClientPeg.get().checkSecretStorageKey = () => true;
|
||||||
testInstance.getInstance()._onRecoveryKeyChange(e);
|
testInstance.getInstance().onRecoveryKeyChange(e);
|
||||||
// force a validation now because it debounces
|
// force a validation now because it debounces
|
||||||
await testInstance.getInstance()._validateRecoveryKey();
|
await testInstance.getInstance().validateRecoveryKey();
|
||||||
const { recoveryKeyValid } = testInstance.getInstance().state;
|
const { recoveryKeyValid } = testInstance.getInstance().state;
|
||||||
expect(recoveryKeyValid).toBe(true);
|
expect(recoveryKeyValid).toBe(true);
|
||||||
});
|
});
|
||||||
@ -69,9 +69,9 @@ describe("AccessSecretStorageDialog", function() {
|
|||||||
MatrixClientPeg.get().keyBackupKeyFromRecoveryKey = () => {
|
MatrixClientPeg.get().keyBackupKeyFromRecoveryKey = () => {
|
||||||
throw new Error("that's no key");
|
throw new Error("that's no key");
|
||||||
};
|
};
|
||||||
testInstance.getInstance()._onRecoveryKeyChange(e);
|
testInstance.getInstance().onRecoveryKeyChange(e);
|
||||||
// force a validation now because it debounces
|
// force a validation now because it debounces
|
||||||
await testInstance.getInstance()._validateRecoveryKey();
|
await testInstance.getInstance().validateRecoveryKey();
|
||||||
|
|
||||||
const { recoveryKeyValid, recoveryKeyCorrect } = testInstance.getInstance().state;
|
const { recoveryKeyValid, recoveryKeyCorrect } = testInstance.getInstance().state;
|
||||||
expect(recoveryKeyValid).toBe(false);
|
expect(recoveryKeyValid).toBe(false);
|
||||||
@ -98,8 +98,8 @@ describe("AccessSecretStorageDialog", function() {
|
|||||||
const e = { target: { value: "a" } };
|
const e = { target: { value: "a" } };
|
||||||
stubClient();
|
stubClient();
|
||||||
MatrixClientPeg.get().isValidRecoveryKey = () => false;
|
MatrixClientPeg.get().isValidRecoveryKey = () => false;
|
||||||
testInstance.getInstance()._onPassPhraseChange(e);
|
testInstance.getInstance().onPassPhraseChange(e);
|
||||||
await testInstance.getInstance()._onPassPhraseNext({ preventDefault: () => {} });
|
await testInstance.getInstance().onPassPhraseNext({ preventDefault: () => {} });
|
||||||
const notification = testInstance.root.findByProps({
|
const notification = testInstance.root.findByProps({
|
||||||
className: "mx_AccessSecretStorageDialog_keyStatus",
|
className: "mx_AccessSecretStorageDialog_keyStatus",
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user