Skip to content

Commit 2e514d6

Browse files
committed
test: fix snapshot test
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.
1 parent c66a2ab commit 2e514d6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

__tests__/snapshot.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import renderer from 'react-test-renderer';
33
import Index from '../pages/index';
44

55
it('renders homepage unchanged', () => {
6+
const mockFooterDate = new Date(2023, 0, 1);
7+
jest.spyOn(global, 'Date').mockImplementation(() => mockFooterDate);
8+
69
const apprenticeData = {
710
currentApprenticeGroup: {
811
version: '0.0',

0 commit comments

Comments
 (0)