Skip to content

Commit

Permalink
fix: manage-hierarchy.spec.ts/getWarningInfo test
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpascal committed Jan 6, 2025
1 parent dc263be commit 4bd1123
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/lib/manage-hierarchy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@ describe('lib/manage-hierarchy.ts', () => {
});

describe('getWarningInfo', () => {
let clock;

// Mocking the system clock to set the current date to June 15, 2024 (quite middle).
// This ensures consistent test behavior for relative date calculations.
// Related issue: https://github.com/medic/cht-user-management/issues/238
beforeEach(() => {
const fixedDate = DateTime.local(2024, 6, 15).toJSDate();
clock = sinon.useFakeTimers(fixedDate.getTime());
});

afterEach(() => {
// Restore the original system clock behavior after tests.
clock.restore();
});


const fakeJob: JobParams = { jobName: 'foo', jobData: { sourceId: 'abc' }};

it('below thrsholds', async () => {
Expand Down

0 comments on commit 4bd1123

Please sign in to comment.