feat: notification service
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package notification
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var expectedNotificationIntentAcceptanceDocumentationSnippets = []string{
|
||||
"`NOTIFICATION_INTENTS_READ_BLOCK_TIMEOUT` with default `2s`",
|
||||
"`NOTIFICATION_ADMIN_EMAILS_LOBBY_APPLICATION_SUBMITTED`",
|
||||
"when no stored stream offset exists, the consumer starts from `0-0`",
|
||||
"the persisted offset advances only after durable acceptance or durable malformed-intent recording",
|
||||
"`failure_code=idempotency_conflict`",
|
||||
"Accepted intents use the original Redis Stream `stream_entry_id` as `notification_id`.",
|
||||
}
|
||||
|
||||
func TestNotificationIntentAcceptanceDocsStayInSync(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
readme := loadTextFile(t, "README.md")
|
||||
flowsDoc := loadTextFile(t, filepath.Join("docs", "flows.md"))
|
||||
runtimeDoc := loadTextFile(t, filepath.Join("docs", "runtime.md"))
|
||||
docsIndex := loadTextFile(t, filepath.Join("docs", "README.md"))
|
||||
normalizedReadme := normalizeWhitespace(readme)
|
||||
normalizedFlowsDoc := normalizeWhitespace(flowsDoc)
|
||||
normalizedRuntimeDoc := normalizeWhitespace(runtimeDoc)
|
||||
|
||||
require.Contains(t, docsIndex, "- [Main flows](flows.md)")
|
||||
|
||||
for _, snippet := range expectedNotificationIntentAcceptanceDocumentationSnippets {
|
||||
normalizedSnippet := normalizeWhitespace(snippet)
|
||||
require.Contains(t, normalizedReadme, normalizedSnippet)
|
||||
}
|
||||
|
||||
require.Contains(t, normalizedRuntimeDoc, normalizeWhitespace("starts from stored offset or `0-0`"))
|
||||
require.Contains(t, normalizedFlowsDoc, normalizeWhitespace("Duplicate handling is scoped by `(producer, idempotency_key)`"))
|
||||
require.Contains(t, normalizedFlowsDoc, normalizeWhitespace("same normalized content"))
|
||||
require.Contains(t, normalizedFlowsDoc, normalizeWhitespace("idempotency conflict"))
|
||||
}
|
||||
Reference in New Issue
Block a user