aboutsummaryrefslogtreecommitdiffstats
path: root/web/web_test.go
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-15 17:30:34 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-15 17:30:34 -0800
commit90c1a68d6478138f538094fc83e48da8ddd21fa0 (patch)
tree90c5e03ec49bb0790ca849f6dac09786cd93bce3 /web/web_test.go
parent7ceec2469ecb047ed8f9c8e2149323d8500773e2 (diff)
downloadneko-90c1a68d6478138f538094fc83e48da8ddd21fa0.tar.gz
neko-90c1a68d6478138f538094fc83e48da8ddd21fa0.tar.bz2
neko-90c1a68d6478138f538094fc83e48da8ddd21fa0.zip
Scaffold Vanilla JS Frontend (v3): Create directory, update Makefile/web.go, embed dist/v3
Diffstat (limited to 'web/web_test.go')
-rw-r--r--web/web_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/web/web_test.go b/web/web_test.go
index ad79581..a208155 100644
--- a/web/web_test.go
+++ b/web/web_test.go
@@ -422,7 +422,7 @@ func TestServeFrontend(t *testing.T) {
rr := httptest.NewRecorder()
// Mimic the routing in Serve()
- handler := http.StripPrefix("/v2/", http.HandlerFunc(ServeFrontend))
+ handler := http.StripPrefix("/v2/", ServeFrontend("dist/v2"))
handler.ServeHTTP(rr, req)
// We expect 200 if built, or maybe panic if box not found (rice.MustFindBox)
@@ -517,7 +517,7 @@ func TestServeFrontendEdgeCases(t *testing.T) {
// 1. Missing file with extension should 404
req := httptest.NewRequest("GET", "/v2/missing.js", nil)
rr := httptest.NewRecorder()
- handler := http.StripPrefix("/v2/", http.HandlerFunc(ServeFrontend))
+ handler := http.StripPrefix("/v2/", ServeFrontend("dist/v2"))
handler.ServeHTTP(rr, req)
if rr.Code != http.StatusNotFound {
t.Errorf("Expected %d for missing asset, got %d", http.StatusNotFound, rr.Code)
@@ -632,7 +632,7 @@ func TestImageProxyHandlerInvalidBase64(t *testing.T) {
func TestServeFrontendNotFound(t *testing.T) {
req := httptest.NewRequest("GET", "/not-actually-a-file", nil)
rr := httptest.NewRecorder()
- ServeFrontend(rr, req)
+ ServeFrontend("dist/v2")(rr, req)
// Should fallback to index.html if it's not a dot-extension file
if rr.Code != http.StatusOK {
t.Errorf("Expected %d (fallback to index.html), got %d", http.StatusOK, rr.Code)
@@ -665,7 +665,7 @@ func TestImageProxyHeaders(t *testing.T) {
func TestServeFrontendAssetNotFound(t *testing.T) {
req := httptest.NewRequest("GET", "/static/missing.js", nil)
rr := httptest.NewRecorder()
- ServeFrontend(rr, req)
+ ServeFrontend("dist/v2")(rr, req)
if rr.Code != http.StatusNotFound {
t.Errorf("Expected %d for missing asset, got %d", http.StatusNotFound, rr.Code)
}