Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
fix: fix time based test
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmeyer committed Mar 4, 2020
1 parent 9c786cf commit 99e6cdf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/__tests__/clients/db/PatientRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,14 @@ describe('patient repository', () => {
})

it('should update the last updated date', async () => {
jest.useFakeTimers()
const existingPatient = await PatientRepository.save({
fullName: 'test7 test7',
} as Patient)
existingPatient.givenName = 'givenName'

jest.advanceTimersByTime(1000)

const updatedPatient = await PatientRepository.saveOrUpdate(existingPatient)

expect(isAfter(updatedPatient.lastUpdatedDate, updatedPatient.createdDate)).toBeTruthy()
Expand Down

0 comments on commit 99e6cdf

Please sign in to comment.