Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/components/AllRead.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { render } from '@testing-library/react';
import { AllRead } from './AllRead';
import { mockMathRandom } from './test-utils';

describe('components/AllRead.tsx', () => {
const originalMathRandom = Math.random;

// The read emoji randomly rotates, but then the snapshots would never match
// Have to make it consistent so the emojis are always the same
mockMathRandom(0.1);
beforeEach(() => {
global.Math.random = jest.fn(() => 0.1);
});

afterEach(() => {
global.Math.random = originalMathRandom;
});

it('should render itself & its children', () => {
const tree = render(<AllRead />);
Expand Down
11 changes: 0 additions & 11 deletions src/components/test-utils.ts

This file was deleted.