mirror of
https://github.com/vector-im/element-call.git
synced 2026-01-18 02:32:27 +00:00
test: use setSystemTime for better test stability
This commit is contained in:
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { beforeEach, describe, expect, test, vi } from "vitest";
|
||||
import { render, configure } from "@testing-library/react";
|
||||
|
||||
import { RaisedHandIndicator } from "./RaisedHandIndicator";
|
||||
@@ -15,6 +15,13 @@ configure({
|
||||
});
|
||||
|
||||
describe("RaisedHandIndicator", () => {
|
||||
const fixedTime = new Date("2025-01-01T12:00:00.000Z");
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
vi.setSystemTime(fixedTime);
|
||||
});
|
||||
|
||||
test("renders nothing when no hand has been raised", () => {
|
||||
const { container } = render(<RaisedHandIndicator />);
|
||||
expect(container.firstChild).toBeNull();
|
||||
|
||||
@@ -15,7 +15,7 @@ exports[`RaisedHandIndicator > renders a smaller indicator when miniature is spe
|
||||
</span>
|
||||
</div>
|
||||
<p>
|
||||
00:01
|
||||
00:00
|
||||
</p>
|
||||
</div>
|
||||
`;
|
||||
@@ -35,7 +35,7 @@ exports[`RaisedHandIndicator > renders an indicator when a hand has been raised
|
||||
</span>
|
||||
</div>
|
||||
<p>
|
||||
00:01
|
||||
00:00
|
||||
</p>
|
||||
</div>
|
||||
`;
|
||||
@@ -55,7 +55,7 @@ exports[`RaisedHandIndicator > renders an indicator when a hand has been raised
|
||||
</span>
|
||||
</div>
|
||||
<p>
|
||||
01:01
|
||||
01:00
|
||||
</p>
|
||||
</div>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user