feat(platform): add the notification inbox and deterministic match search
This commit is contained in:
1 parent
5edff21d2d
commit
0b11021b16
169 files changed
+17083
-443
No files matched your search
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"lincodex/backend/config"
|
||||
"lincodex/backend/internal/adapter/secondary/prometheus"
|
||||
"lincodex/backend/internal/domain"
|
||||
"lincodex/backend/internal/port/inbound"
|
||||
"lincodex/backend/internal/port/outbound"
|
||||
"lincodex/backend/internal/usecase/notification"
|
||||
@@ -77,17 +78,31 @@ func TestBuildEventConsumersSkipsWithoutWork(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBootstrapRegistersTheDeliveryHandler(t *testing.T) {
|
||||
func TestBootstrapRegistersTheDeliveryAndInboxHandlers(t *testing.T) {
|
||||
handlers, err := eventHandlers(consumerTestConfig(t), slog.New(slog.DiscardHandler))
|
||||
if err != nil {
|
||||
t.Fatalf("eventHandlers() error = %v", err)
|
||||
}
|
||||
if len(handlers) != 1 || handlers[0].ConsumerName() != notification.DeliveryConsumerName {
|
||||
if len(handlers) != 2 || handlers[0].ConsumerName() != notification.DeliveryConsumerName ||
|
||||
handlers[1].ConsumerName() != notification.InboxConsumerName {
|
||||
t.Fatalf("eventHandlers() = %v; update the documentation when the registered consumers change", handlers)
|
||||
}
|
||||
if !handlers[0].Handles(notification.MailRequestedEventType) {
|
||||
t.Fatalf("the delivery handler does not handle %s", notification.MailRequestedEventType)
|
||||
}
|
||||
if !handlers[1].Handles(string(domain.NotificationInboxInvitationDelivered)) ||
|
||||
handlers[1].Handles(notification.MailRequestedEventType) {
|
||||
t.Fatal("the inbox handler must handle the invitation event and no mail request")
|
||||
}
|
||||
if handlers[1].Handles(string(domain.NotificationInboxSyntheticDelivered)) {
|
||||
t.Fatal("the synthetic inbox event is handled although its switch is off by default")
|
||||
}
|
||||
settings := consumerTestConfig(t)
|
||||
settings.NotificationSyntheticEnabled = true
|
||||
enabled, err := eventHandlers(settings, slog.New(slog.DiscardHandler))
|
||||
if err != nil || !enabled[1].Handles(string(domain.NotificationInboxSyntheticDelivered)) {
|
||||
t.Fatalf("the synthetic inbox event is not handled with its switch on: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBootstrapRefusesAnInvalidMailAccountForDeliveries(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user