(t *testing.T, basePath string)
| 15 | ) |
| 16 | |
| 17 | func 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 | |
| 41 | func TestBasePathHealthz(t *testing.T) { |
| 42 | srv := newBasePathServer(t, "/zennotes") |
no test coverage detected