MCPcopy Index your code
hub / github.com/ZenNotes/zennotes / newBasePathServer

Function newBasePathServer

apps/server/internal/httpserver/basepath_test.go:17–39  ·  view source on GitHub ↗
(t *testing.T, basePath string)

Source from the content-addressed store, hash-verified

15)
16
17func newBasePathServer(t *testing.T, basePath string) *httptest.Server {
18 t.Helper()
19 cfg := config.Config{
20 VaultPath: t.TempDir(),
21 Bind: "127.0.0.1:0",
22 BasePath: basePath,
23 AllowInsecureNoAuth: true,
24 }
25 v, err := vault.New(cfg.VaultPath, vault.Options{})
26 if err != nil {
27 t.Fatalf("vault.New: %v", err)
28 }
29 static := fstest.MapFS{
30 "index.html": &fstest.MapFile{
31 Data: []byte("<!doctype html><html><head><title>ZenNotes</title></head><body></body></html>"),
32 },
33 "manifest.webmanifest": &fstest.MapFile{Data: []byte("{}")},
34 "assets/index-test.css": &fstest.MapFile{Data: []byte("body{color:red}")},
35 }
36 srv := httptest.NewServer(New(v, nil, fs.FS(static), cfg).Router())
37 t.Cleanup(srv.Close)
38 return srv
39}
40
41func TestBasePathHealthz(t *testing.T) {
42 srv := newBasePathServer(t, "/zennotes")

Calls 2

RouterMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected