From 2e514d64e49d9402141b542e74d48bc7926141d7 Mon Sep 17 00:00:00 2001 From: Jon Oliver Date: Tue, 21 May 2024 16:44:36 -0400 Subject: [PATCH] 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. --- __tests__/snapshot.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/__tests__/snapshot.js b/__tests__/snapshot.js index 1b6bd13..1688621 100644 --- a/__tests__/snapshot.js +++ b/__tests__/snapshot.js @@ -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',