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 4b94d53
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/__tests__/clients/db/PatientRepository.test.ts
Expand Up @@ -182,10 +182,9 @@ describe('patient repository', () => {
})

it('should update the last updated date', async () => {
const existingPatient = await PatientRepository.save({
fullName: 'test7 test7',
} as Patient)
existingPatient.givenName = 'givenName'
const time = getTime(new Date(2020, 1, 1))
await patients.put({ _id: 'id2222222', createdDate: time, lastUpdatedDate: time })
const existingPatient = await PatientRepository.find('id2222222')

const updatedPatient = await PatientRepository.saveOrUpdate(existingPatient)

Expand All @@ -194,12 +193,9 @@ describe('patient repository', () => {
})

it('should not update the created date', async () => {
const existingPatient = await PatientRepository.save({
fullName: 'test7 test7',
} as Patient)
existingPatient.givenName = 'givenName'
existingPatient.createdDate = getTime(new Date())

const time = getTime(new Date(2020, 1, 1))
await patients.put({ _id: 'id111111', createdDate: time, lastUpdatedDate: time })
const existingPatient = await PatientRepository.find('id111111')
const updatedPatient = await PatientRepository.saveOrUpdate(existingPatient)

expect(updatedPatient.createdDate).toEqual(existingPatient.createdDate)
Expand Down

0 comments on commit 4b94d53

Please sign in to comment.