-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocumentation_test.go
More file actions
44 lines (40 loc) · 1.14 KB
/
documentation_test.go
File metadata and controls
44 lines (40 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package chat_test
import (
"os"
"strings"
"testing"
)
func TestDocumentationCoversIntentionalVercelDifferences(t *testing.T) {
t.Parallel()
readme, err := os.ReadFile("README.md")
if err != nil {
t.Fatalf("read README.md: %v", err)
}
readmeText := string(readme)
for _, phrase := range []string{
"not a TypeScript API port",
"Handlers are single-slot per hook",
"no dedicated `OnDirectMessage` hook",
"no public proactive `OpenDM`",
"no thread application state APIs",
"no full Vercel Chat SDK feature parity",
} {
if !strings.Contains(readmeText, phrase) {
t.Fatalf("README.md does not mention %q", phrase)
}
}
runtimeSource, err := os.ReadFile("runtime.go")
if err != nil {
t.Fatalf("read runtime.go: %v", err)
}
sourceText := string(runtimeSource)
for _, phrase := range []string{
"OnNewMention installs or atomically replaces the single new-mention handler",
"intentionally differs from Vercel Chat SDK",
"OnSubscribedMessage installs or atomically replaces the single subscribed-message handler",
} {
if !strings.Contains(sourceText, phrase) {
t.Fatalf("runtime GoDoc does not mention %q", phrase)
}
}
}