We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d024198 commit 3409139Copy full SHA for 3409139
src/components/AllRead.test.tsx
@@ -1,11 +1,18 @@
1
import { render } from '@testing-library/react';
2
import { AllRead } from './AllRead';
3
-import { mockMathRandom } from './test-utils';
4
5
describe('components/AllRead.tsx', () => {
+ const originalMathRandom = Math.random;
6
+
7
// The read emoji randomly rotates, but then the snapshots would never match
8
// Have to make it consistent so the emojis are always the same
- mockMathRandom(0.1);
9
+ beforeEach(() => {
10
+ global.Math.random = jest.fn(() => 0.1);
11
+ });
12
13
+ afterEach(() => {
14
+ global.Math.random = originalMathRandom;
15
16
17
it('should render itself & its children', () => {
18
const tree = render(<AllRead />);
src/components/test-utils.ts
0 commit comments