44 lines
2.1 KiB
Go
44 lines
2.1 KiB
Go
package notification
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
var expectedNotificationUserEnrichmentDocumentationSnippets = []string{
|
|
"one trusted `User Service` HTTP enrichment client",
|
|
"user-targeted route enrichment during intent acceptance before durable write",
|
|
"`404 subject_not_found` from `User Service` is recorded under malformed-intent storage with `failure_code=recipient_not_found`",
|
|
"temporary `User Service` lookup failures stop the consumer before stream-offset advance",
|
|
"current implemented support is exactly one locale: `en`",
|
|
"no intermediate locale reduction is used in v1",
|
|
}
|
|
|
|
func TestNotificationUserEnrichmentDocsStayInSync(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
readme := loadTextFile(t, "README.md")
|
|
flowsDoc := loadTextFile(t, filepath.Join("docs", "flows.md"))
|
|
docsIndex := loadTextFile(t, filepath.Join("docs", "README.md"))
|
|
architecture := loadTextFile(t, filepath.Join("..", "ARCHITECTURE.md"))
|
|
normalizedReadme := normalizeWhitespace(readme)
|
|
normalizedFlowsDoc := normalizeWhitespace(flowsDoc)
|
|
normalizedArchitecture := normalizeWhitespace(architecture)
|
|
|
|
require.Contains(t, docsIndex, "- [Main flows](flows.md)")
|
|
require.Contains(t, normalizedArchitecture, normalizeWhitespace("Acceptance of a user-targeted notification intent is complete only after every"))
|
|
require.Contains(t, normalizedArchitecture, normalizeWhitespace("unresolved user ids are treated as producer input defects"))
|
|
|
|
for _, snippet := range expectedNotificationUserEnrichmentDocumentationSnippets {
|
|
normalizedSnippet := normalizeWhitespace(snippet)
|
|
require.Contains(t, normalizedReadme, normalizedSnippet)
|
|
}
|
|
|
|
require.Contains(t, normalizedFlowsDoc, normalizeWhitespace("User-targeted routes are enriched before durable route write"))
|
|
require.Contains(t, normalizedFlowsDoc, normalizeWhitespace("supported resolved locale is exactly `en`"))
|
|
require.Contains(t, normalizedFlowsDoc, normalizeWhitespace("record malformed intent recipient_not_found"))
|
|
require.Contains(t, normalizedFlowsDoc, normalizeWhitespace("stop before stream-offset advance"))
|
|
}
|