feat(notification): add durable mail delivery state
This commit is contained in:
1 parent
391c8a6cec
commit
2db585fbff
41 files changed
+4903
-108
No files matched your search
@@ -16,6 +16,7 @@ import (
|
||||
"lincodex/backend/internal/adapter/secondary/prometheus"
|
||||
"lincodex/backend/internal/port/inbound"
|
||||
"lincodex/backend/internal/port/outbound"
|
||||
"lincodex/backend/internal/usecase/notification"
|
||||
"lincodex/backend/internal/worker/eventconsumer"
|
||||
)
|
||||
|
||||
@@ -75,9 +76,24 @@ func TestBuildEventConsumersSkipsWithoutWork(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBootstrapRegistersNoEventHandlerYet(t *testing.T) {
|
||||
if handlers := eventHandlers(); len(handlers) != 0 {
|
||||
t.Fatalf("eventHandlers() = %d handlers; update the documentation when the first consumer is registered", len(handlers))
|
||||
func TestBootstrapRegistersTheDeliveryHandler(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 {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBootstrapRefusesAnInvalidMailAccountForDeliveries(t *testing.T) {
|
||||
settings := consumerTestConfig(t)
|
||||
settings.EmailAccount = "Not A Label"
|
||||
if _, err := eventHandlers(settings, slog.New(slog.DiscardHandler)); err == nil {
|
||||
t.Fatal("eventHandlers() accepted an invalid provider account label")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user