feat: notification service
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package notification
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestNotificationDocumentationStaysPlanIndependent(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
currentDocs := map[string]string{
|
||||
"README.md": loadTextFile(t, "README.md"),
|
||||
"docs/README.md": loadTextFile(t, filepath.Join("docs", "README.md")),
|
||||
"docs/runtime.md": loadTextFile(t, filepath.Join("docs", "runtime.md")),
|
||||
"docs/flows.md": loadTextFile(t, filepath.Join("docs", "flows.md")),
|
||||
"docs/runbook.md": loadTextFile(t, filepath.Join("docs", "runbook.md")),
|
||||
"docs/examples.md": loadTextFile(t, filepath.Join("docs", "examples.md")),
|
||||
"openapi.yaml": loadTextFile(t, "openapi.yaml"),
|
||||
}
|
||||
|
||||
forbiddenPlan := "PLAN" + ".md"
|
||||
historicalSlug := "sta" + "ge" + "-"
|
||||
forbiddenHistoricalDocLink := "docs/" + historicalSlug
|
||||
forbiddenHistoricalSlug := historicalSlug
|
||||
forbiddenHistoricalWord := "Sta" + "ge "
|
||||
|
||||
for path, content := range currentDocs {
|
||||
require.NotContains(t, content, forbiddenPlan, path)
|
||||
require.NotContains(t, content, forbiddenHistoricalDocLink, path)
|
||||
require.NotContains(t, content, forbiddenHistoricalSlug, path)
|
||||
require.NotContains(t, content, forbiddenHistoricalWord, path)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotificationCrossServiceDocumentationStaysInSync(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
readme := loadTextFile(t, "README.md")
|
||||
testingDoc := loadTextFile(t, filepath.Join("..", "TESTING.md"))
|
||||
architecture := loadTextFile(t, filepath.Join("..", "ARCHITECTURE.md"))
|
||||
mailReadme := loadTextFile(t, filepath.Join("..", "mail", "README.md"))
|
||||
geoProfileReadme := loadTextFile(t, filepath.Join("..", "geoprofile", "README.md"))
|
||||
gatewayReadme := loadTextFile(t, filepath.Join("..", "gateway", "README.md"))
|
||||
|
||||
for _, content := range []string{readme, testingDoc, architecture, mailReadme, geoProfileReadme, gatewayReadme} {
|
||||
normalizedContent := normalizeWhitespace(content)
|
||||
require.Contains(t, normalizedContent, normalizeWhitespace("auth-code"))
|
||||
require.Contains(t, normalizedContent, normalizeWhitespace("Notification Service"))
|
||||
}
|
||||
|
||||
require.Contains(t, normalizeWhitespace(readme), normalizeWhitespace("Real producer-boundary suites for `Game Master`, `Game Lobby`, and `Geo Profile Service` should be added only when those service boundaries exist in code."))
|
||||
require.Contains(t, normalizeWhitespace(testingDoc), normalizeWhitespace("`notificationgateway`"))
|
||||
require.Contains(t, normalizeWhitespace(testingDoc), normalizeWhitespace("`notificationmail`"))
|
||||
require.Contains(t, normalizeWhitespace(readme), normalizeWhitespace("real black-box `Notification Service -> Gateway` push fan-out coverage"))
|
||||
}
|
||||
Reference in New Issue
Block a user