Skip to content

Commit

Permalink
Randomize tests thx to Jest 29.5 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrotoff committed Mar 9, 2023
1 parent 7646f9c commit 3f4d55b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"build": "npm run clean && API=stubs node --trace-deprecation node_modules/.bin/webpack --mode=development",
"build:prod": "npm run clean && API=marvel.com webpack --mode=production",
"build:prod:analyze": "npm run clean && API=marvel.com webpack --mode=production --analyze",
"test": "API=stubs jest --verbose",
"test:coverage": "API=stubs jest --coverage",
"test": "API=stubs jest --randomize --verbose",
"test:coverage": "API=stubs jest --randomize --coverage",
"test:e2e": "API=stubs playwright test",
"test:e2e:stubs": "npm run test:e2e",
"audit": "npm run clean && playwright test --config=playwright-lighthouse.config.ts",
Expand Down
2 changes: 0 additions & 2 deletions src/Hero.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jest.mock('react-router', () => ({
const useParamsMock = jest.mocked(useParams);

test('page title', async () => {
expect(document.title).toEqual('');

useParamsMock.mockReturnValue({ id: '1011334' });
const { rerender } = render(<Hero />);
expect(document.title).toEqual('... - Marvel Heroes');
Expand Down
2 changes: 0 additions & 2 deletions src/Heroes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { Heroes } from './Heroes';
jest.mock('./api/Marvel');

test('page title', async () => {
expect(document.title).toEqual('');

const { rerender } = render(
<MemoryRouter>
<Heroes page={0} />
Expand Down
1 change: 0 additions & 1 deletion src/utils/usePageTitle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { renderHook } from '@testing-library/react';
import { usePageTitle } from './usePageTitle';

test('usePageTitle()', () => {
expect(document.title).toEqual('');
renderHook(() => usePageTitle('3-D Man'));
expect(document.title).toEqual('3-D Man - Marvel Heroes');
});

0 comments on commit 3f4d55b

Please sign in to comment.