Skip to content

Commit

Permalink
Added a test to ensure we can find anonymous pulse responses without …
Browse files Browse the repository at this point in the history
…causing an internal error.
  • Loading branch information
ocielliottc committed Jan 15, 2025
1 parent ca5bc15 commit d8309ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ default PulseResponse createADefaultPulseResponse(MemberProfile memberprofile) {
return getPulseResponseRepository().save(new PulseResponse(0, 0, LocalDate.now(),
memberprofile.getId(), "internalfeelings", "externalfeelings"));
}

default PulseResponse createADefaultAnonymousPulseResponse() {
return getPulseResponseRepository().save(new PulseResponse(0, 0, LocalDate.now(),
null, "internalfeelings", "externalfeelings"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,22 @@ void testGetFindByfindBySubmissionDateBetween() {
assertEquals(Set.of(pulseResponse), response.body());
}

@Test
void testAnonymousGetFindByfindBySubmissionDateBetween() {
MemberProfile memberProfile = createADefaultMemberProfile();

PulseResponse pulseResponse = createADefaultAnonymousPulseResponse();

LocalDate testDateFrom = LocalDate.of(2019, 1, 1);
LocalDate testDateTo = Util.MAX.toLocalDate();

final HttpRequest<?> request = HttpRequest.GET(String.format("/?dateFrom=%tF&dateTo=%tF", testDateFrom, testDateTo)).basicAuth(memberProfile.getWorkEmail(), ADMIN_ROLE);
final HttpResponse<Set<PulseResponse>> response = client.toBlocking().exchange(request, Argument.setOf(PulseResponse.class));

assertEquals(HttpStatus.OK, response.getStatus());
assertEquals(Set.of(pulseResponse), response.body());
}

@Test
void testGetFindById() {

Expand Down

0 comments on commit d8309ff

Please sign in to comment.