fix(notifications): dispatcher race с OutboxPoller — emails never sent
This commit is contained in:
+4
-4
@@ -108,7 +108,7 @@ class NotificationsDispatcherTest {
|
||||
String makerEmail = "maker@nstart.space";
|
||||
|
||||
OutboxEvent event = buildDraftApprovedEvent(draftId, makerId);
|
||||
when(outboxRepository.findUnpublished(any(Pageable.class))).thenReturn(List.of(event));
|
||||
when(outboxRepository.findRecentByEventTypes(any(), any(), any(Pageable.class))).thenReturn(List.of(event));
|
||||
|
||||
UserRef makerRef = new UserRef(makerId, makerEmail, null, null, Locale.forLanguageTag("ru"));
|
||||
when(recipientResolver.resolveById(makerId)).thenReturn(Optional.of(makerRef));
|
||||
@@ -140,7 +140,7 @@ class NotificationsDispatcherTest {
|
||||
new ObjectMapper().createObjectNode(),
|
||||
"ordinis.cuod.events.public", "spacecraft:test");
|
||||
|
||||
when(outboxRepository.findUnpublished(any(Pageable.class))).thenReturn(List.of(event));
|
||||
when(outboxRepository.findRecentByEventTypes(any(), any(), any(Pageable.class))).thenReturn(List.of(event));
|
||||
|
||||
dispatcher.sendTick();
|
||||
|
||||
@@ -154,7 +154,7 @@ class NotificationsDispatcherTest {
|
||||
UUID draftId = UUID.randomUUID();
|
||||
String makerId = "maker-sub-456";
|
||||
OutboxEvent event = buildDraftApprovedEvent(draftId, makerId);
|
||||
when(outboxRepository.findUnpublished(any(Pageable.class))).thenReturn(List.of(event));
|
||||
when(outboxRepository.findRecentByEventTypes(any(), any(), any(Pageable.class))).thenReturn(List.of(event));
|
||||
|
||||
UserRef makerRef = new UserRef(makerId, "maker@nstart.space", null, null, Locale.forLanguageTag("ru"));
|
||||
when(recipientResolver.resolveById(makerId)).thenReturn(Optional.of(makerRef));
|
||||
@@ -182,7 +182,7 @@ class NotificationsDispatcherTest {
|
||||
void unknownMaker_noDispatch() {
|
||||
UUID draftId = UUID.randomUUID();
|
||||
OutboxEvent event = buildDraftApprovedEvent(draftId, "unknown-sub");
|
||||
when(outboxRepository.findUnpublished(any(Pageable.class))).thenReturn(List.of(event));
|
||||
when(outboxRepository.findRecentByEventTypes(any(), any(), any(Pageable.class))).thenReturn(List.of(event));
|
||||
|
||||
when(recipientResolver.resolveById("unknown-sub")).thenReturn(Optional.empty());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user