Skip to content

Commit

Permalink
test: remove test-util (#1266)
Browse files Browse the repository at this point in the history
  • Loading branch information
setchy committed Jun 18, 2024
1 parent d024198 commit 3409139
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
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.

0 comments on commit 3409139

Please sign in to comment.