Skip to content

Commit

Permalink
test: fix snapshot test
Browse files Browse the repository at this point in the history
The snapshot test included footer, which uses the Date object for the copyright data.
This fix mocks the Date object in the test so that it doesn't change.
  • Loading branch information
jonoliver committed May 21, 2024
1 parent c66a2ab commit 2e514d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions __tests__/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import renderer from 'react-test-renderer';
import Index from '../pages/index';

it('renders homepage unchanged', () => {
const mockFooterDate = new Date(2023, 0, 1);
jest.spyOn(global, 'Date').mockImplementation(() => mockFooterDate);

const apprenticeData = {
currentApprenticeGroup: {
version: '0.0',
Expand Down

0 comments on commit 2e514d6

Please sign in to comment.