Skip to content

Commit 6714e67

Browse files
authored
Merge pull request Expensify#76356 from callstack-internal/test/validation-utils-test-mock-date
[NO QA] add fake timers to ValidationUtilsTest for consistent date handlin
2 parents afd0321 + 44279c8 commit 6714e67

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎tests/unit/ValidationUtilsTest.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ import {translateLocal} from '../utils/TestHelper';
2525
global.TextEncoder = TextEncoder as typeof global.TextEncoder;
2626

2727
describe('ValidationUtils', () => {
28+
beforeAll(() => {
29+
jest.useFakeTimers();
30+
jest.setSystemTime(new Date('2024-01-15'));
31+
});
32+
33+
afterAll(() => {
34+
jest.useRealTimers();
35+
});
36+
2837
describe('isValidDate', () => {
2938
test('Should return true for a valid date within the range', () => {
3039
const validDate = '2023-07-18';

0 commit comments

Comments
 (0)