Skip to content

Commit 3409139

Browse files
authored
test: remove test-util (#1266)
1 parent d024198 commit 3409139

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/components/AllRead.test.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import { render } from '@testing-library/react';
22
import { AllRead } from './AllRead';
3-
import { mockMathRandom } from './test-utils';
43

54
describe('components/AllRead.tsx', () => {
5+
const originalMathRandom = Math.random;
6+
67
// The read emoji randomly rotates, but then the snapshots would never match
78
// Have to make it consistent so the emojis are always the same
8-
mockMathRandom(0.1);
9+
beforeEach(() => {
10+
global.Math.random = jest.fn(() => 0.1);
11+
});
12+
13+
afterEach(() => {
14+
global.Math.random = originalMathRandom;
15+
});
916

1017
it('should render itself & its children', () => {
1118
const tree = render(<AllRead />);

src/components/test-utils.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)