site: publish the platform guides at /platforms/ and link them from an About page
(cherry picked from commit 408d6cdfd76d13945db1d9727b58feca23d1e48b)
This commit is contained in:
42
internal/site/platforms_test.go
Normal file
42
internal/site/platforms_test.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package site
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRenderPlatformsShowsTheGuides(t *testing.T) {
|
||||
root, err := filepath.Abs(filepath.Join("..", ".."))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out := t.TempDir()
|
||||
count, err := RenderPlatforms(root, out)
|
||||
if err != nil {
|
||||
t.Fatalf("RenderPlatforms: %v", err)
|
||||
}
|
||||
if count != 3 {
|
||||
t.Fatalf("got %d guides, want 3", count)
|
||||
}
|
||||
raw, err := os.ReadFile(filepath.Join(out, "platforms", "index.html"))
|
||||
if err != nil {
|
||||
t.Fatalf("read page: %v", err)
|
||||
}
|
||||
page := strings.ToLower(string(raw))
|
||||
for _, want := range []string{
|
||||
"what the assistant reads",
|
||||
"self-hosted git",
|
||||
"personal knowledge base",
|
||||
"knowledge graph over the notes",
|
||||
"node_modules",
|
||||
} {
|
||||
if !strings.Contains(page, want) {
|
||||
t.Errorf("page does not contain %q", want)
|
||||
}
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(out, "platforms", "index.json")); err != nil {
|
||||
t.Errorf("index.json missing: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user