package updatewords import ( "os" "strings" "testing" ) // TestDocsContainDrafts verifies that the CLI docs and README contain the // drafts from words_surfaces.go byte for byte, so the docs and the drafts // cannot drift before or after Paul's review. func TestDocsContainDrafts(t *testing.T) { tests := []struct { id string path string }{ {"settings.cli.docs-instances-set", "../../docs/site/cli.md"}, {"settings.cli.docs-instances-update", "../../docs/site/cli.md"}, {"settings.cli.docs-apps-set-lead", "../../docs/site/cli.md"}, {"settings.cli.docs-apps-set", "../../docs/site/cli.md"}, {"settings.cli.roll-note", "../../README.md"}, } for _, tt := range tests { t.Run(tt.id, func(t *testing.T) { txt := Text(tt.id) if txt == "" { t.Fatalf("no draft found for %s", tt.id) } content, err := os.ReadFile(tt.path) if err != nil { t.Fatalf("reading %s: %v", tt.path, err) } if !strings.Contains(string(content), txt) { t.Errorf("%s does not contain the draft text for %s: %q", tt.path, tt.id, txt) } }) } }