Skip to content

Commit

Permalink
fix maternal service test
Browse files Browse the repository at this point in the history
  • Loading branch information
mogoodrich committed Oct 18, 2024
1 parent 4b2056e commit 36e524e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void shouldNotGetChildByMotherIfChildNotLinkedByMotherChildRelationship()

@Test
public void shouldNotGetChildByMotherIfChildBornADayOrMoreBeforeVisitAndChildBornDuringMothersActiveVisitSetTrue() {
Date oneHourAgo = new DateTime().minusHours(1).toDate();
Date now = new Date();
Date oneDayAgo = new DateTime().minusDays(1).toDate();

Location visitLocation = testDataManager.location().name("Visit Location").save();
Expand All @@ -183,7 +183,7 @@ public void shouldNotGetChildByMotherIfChildBornADayOrMoreBeforeVisitAndChildBor
motherChildRelationship.setPersonB(child);
personService.saveRelationship(motherChildRelationship);

Visit motherVisit = testDataManager.visit().visitType(emrApiProperties.getAtFacilityVisitType()).location(visitLocation).patient(mother).started(oneHourAgo).save();
Visit motherVisit = testDataManager.visit().visitType(emrApiProperties.getAtFacilityVisitType()).location(visitLocation).patient(mother).started(now).save();

List<MotherAndChild> motherAndChildList = maternalService.getMothersAndChildren(new MothersAndChildrenSearchCriteria(Collections.singletonList(mother.getUuid()), null, false, false, true));

Expand Down

3 comments on commit 36e524e

@mogoodrich
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mseaton can you sanity check this one for me? This test was failing (I believe) when run between midnight and 1am (which on the CI services, in UTC, corresponds to 8pm to 9pm EDT) because "one hour ago" was the same day as one day ago.

This fixes the test but can you confirm this doesn't break what you were trying to test?

@mseaton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me @mogoodrich . AFAICT, you authored this originally and have been the only committer to it, so this isn't something I had any original designs on.

@mogoodrich
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duh, thanks @mseaton !

Please sign in to comment.