pull/21833/head
Zoe 2020-02-11 12:06:40 +00:00
parent a677780889
commit 9a5663056d
1 changed files with 14 additions and 14 deletions

View File

@ -28,15 +28,15 @@ describe("AccessSecretStorageDialog", function () {
<AccessSecretStorageDialog
checkPrivateKey={(p) => p && p.recoveryKey && p.recoveryKey == "a"}
onFinished={(v) => {
if (v) { done() }
if (v) { done(); }
}}
/>
/>,
);
testInstance.getInstance().setState({
recoveryKeyValid: true,
recoveryKey: "a",
});
const e = { preventDefault: () => {} }
const e = { preventDefault: () => {} };
testInstance.getInstance()._onRecoveryKeyNext(e);
});
@ -44,14 +44,14 @@ describe("AccessSecretStorageDialog", function () {
const testInstance = TestRenderer.create(
<AccessSecretStorageDialog
checkPrivateKey={() => true}
/>
/>,
);
const v = "asfd";
const e = { target: { value: v } };
stubClient();
MatrixClientPeg.get().isValidRecoveryKey = function(k) {
return k == v;
}
};
testInstance.getInstance()._onRecoveryKeyChange(e);
const { recoveryKeyValid } = testInstance.getInstance().state;
expect(recoveryKeyValid).toBe(true);
@ -61,7 +61,7 @@ describe("AccessSecretStorageDialog", function () {
const testInstance = TestRenderer.create(
<AccessSecretStorageDialog
checkPrivateKey={async () => false}
/>
/>,
);
const e = { target: { value: "a" } };
stubClient();
@ -76,7 +76,7 @@ describe("AccessSecretStorageDialog", function () {
expect(notification.props.children).toEqual(
["\uD83D\uDC4E ", "Unable to access secret storage. Please verify that you " +
"entered the correct recovery key."]);
done()
done();
});
it("Notifies the user if they input an invalid passphrase", async function(done) {
@ -88,13 +88,13 @@ describe("AccessSecretStorageDialog", function () {
salt: 'nonempty',
iterations: 2,
} } }
/>
/>,
);
const e = { target: { value: "a" } };
stubClient();
MatrixClientPeg.get().isValidRecoveryKey = () => false;
testInstance.getInstance()._onPassPhraseChange(e);
await testInstance.getInstance()._onPassPhraseNext({ preventDefault: () => {} })
await testInstance.getInstance()._onPassPhraseNext({ preventDefault: () => {} });
const notification = testInstance.root.findByProps({
className: "mx_AccessSecretStorageDialog_keyStatus",
});