Upgrade to jest 27 (#7699)

* use jest@27.4.0, replace jest-environment-jsdom-sixteen with jest-environment-jsdom

Signed-off-by: Kerry Archibald <kerrya@element.io>

* polyfill setImmediate

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove done from async test cases

* useRealTimers in test relying on promise flushing

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove jest environment file

Signed-off-by: Kerry Archibald <kerrya@element.io>

* replace ts-jest mocked with jest utils mocked

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-02-02 13:02:17 +01:00 committed by GitHub
parent 70a44a8cd6
commit 292971dd0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 646 additions and 668 deletions

View file

@ -59,7 +59,7 @@ describe("AccessSecretStorageDialog", function() {
expect(recoveryKeyValid).toBe(true);
});
it("Notifies the user if they input an invalid Security Key", async function(done) {
it("Notifies the user if they input an invalid Security Key", async function() {
const testInstance = TestRenderer.create(
<AccessSecretStorageDialog
checkPrivateKey={async () => false}
@ -82,10 +82,9 @@ describe("AccessSecretStorageDialog", function() {
"mx_AccessSecretStorageDialog_recoveryKeyFeedback_invalid",
});
expect(notification.props.children).toEqual("Invalid Security Key");
done();
});
it("Notifies the user if they input an invalid passphrase", async function(done) {
it("Notifies the user if they input an invalid passphrase", async function() {
const testInstance = TestRenderer.create(
<AccessSecretStorageDialog
checkPrivateKey={() => false}
@ -108,7 +107,6 @@ describe("AccessSecretStorageDialog", function() {
});
expect(notification.props.children).toEqual(
["\uD83D\uDC4E ", "Unable to access secret storage. Please verify that you " +
"entered the correct Security Phrase."]);
done();
"entered the correct Security Phrase."]);
});
});

View file

@ -16,7 +16,7 @@ limitations under the License.
import React from 'react';
import { mount } from 'enzyme';
import { mocked } from 'ts-jest/utils';
import { mocked } from 'jest-mock';
import '../../../skinned-sdk';
import { act } from "react-dom/test-utils";
import { Room } from 'matrix-js-sdk';