Skip to content

Commit

Permalink
Reset fake timers
Browse files Browse the repository at this point in the history
  • Loading branch information
bischofmax committed Oct 24, 2023
1 parent 29ff461 commit db09494
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,22 @@ describe('AccountIdmToDtoMapperDb', () => {
id: 'id',
};

const mockDate = new Date();
const dateMock = new Date();
jest.useFakeTimers();
jest.setSystemTime(mockDate);
jest.setSystemTime(dateMock);

return { testIdmEntity, mockDate };
return { testIdmEntity, dateMock };
};

it('should use actual date', () => {
const { testIdmEntity, mockDate } = setup();
const { testIdmEntity, dateMock } = setup();

const ret = mapper.mapToDto(testIdmEntity);

expect(ret.createdAt).toEqual(mockDate);
expect(ret.updatedAt).toEqual(mockDate);
expect(ret.createdAt).toEqual(dateMock);
expect(ret.updatedAt).toEqual(dateMock);

jest.useRealTimers();
});
});

Expand Down

0 comments on commit db09494

Please sign in to comment.