Skip to content

Commit

Permalink
Test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitolo-Andrea committed Nov 26, 2024
1 parent 28b9f7e commit dec196a
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,21 @@ private CitizenConsent createMockCitizenConsent(String hashedFiscalCode, String

return citizenConsent;
}

@Test
void testFindByTppIdEnabled_Success() {
String tppId = "tpp1";
CitizenConsent citizenConsent = createMockCitizenConsent("hashedCode", tppId);

when(mongoTemplate.aggregate(
Mockito.any(Aggregation.class),
Mockito.eq("citizen_consents"),
Mockito.eq(CitizenConsent.class)
)).thenReturn(Flux.just(citizenConsent));

StepVerifier.create(repository.findByTppIdEnabled(tppId))
.expectNextMatches(result -> result.getConsents().containsKey(tppId) && result.getConsents().get(tppId).getTppState())
.verifyComplete();

}
}

0 comments on commit dec196a

Please sign in to comment.