1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Stablize test

This commit is contained in:
Half-Shot
2024-09-10 10:35:38 +01:00
parent 2a14aee55d
commit c43048d2f1
2 changed files with 15 additions and 9 deletions

View File

@@ -100,6 +100,7 @@ let mockRoom: Mocked<Room>;
let mockSpace: Mocked<Room>;
let mockClient: Mocked<MatrixClient>;
let mockCrypto: Mocked<CryptoApi>;
const origDate = global.Date.prototype.toLocaleString;
beforeEach(() => {
mockRoom = mocked({
@@ -240,10 +241,14 @@ describe("<UserInfo />", () => {
});
it("renders user timezone if set", async () => {
// For timezone, force a consistent locale.
jest.spyOn(global.Date.prototype, "toLocaleString").mockImplementation(function (_locale, opts) {
return origDate.call(this, "en-US", opts); // eslint-disable-line @typescript-eslint/no-invalid-this
});
mockClient.doesServerSupportExtendedProfiles.mockResolvedValue(true);
mockClient.getExtendedProfileProperty.mockResolvedValue("Europe/London");
renderComponent();
await expect(screen.findByText(/\d\d:\d\d (am|pm)/)).resolves.toBeInTheDocument();
await expect(screen.findByText(/\d\d:\d\d (AM|PM)/)).resolves.toBeInTheDocument();
});
it("renders encryption info panel without pending verification", () => {