From 4c2c51761e8cb1be25f88eeeca8efbcb0efda57b Mon Sep 17 00:00:00 2001 From: Eva Ho Date: Mon, 15 Dec 2025 17:46:26 -0500 Subject: [PATCH] adding test --- app/ui/app_test.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 app/ui/app_test.go diff --git a/app/ui/app_test.go b/app/ui/app_test.go new file mode 100644 index 000000000..425ed4f88 --- /dev/null +++ b/app/ui/app_test.go @@ -0,0 +1,44 @@ +//go:build windows || darwin + +package ui + +import ( + "io/fs" + "strings" + "testing" +) + +// TestEmbeddedAssets verifies that the correct UI assets are embedded. +// This test will FAIL THE BUILD if wrong files are embedded. +func TestEmbeddedAssets(t *testing.T) { + fsys, err := fs.Sub(appFS, "app/dist") + if err != nil { + t.Fatal("app/dist not found in embedded filesystem - UI not built") + } + + // Check index.html exists + data, err := fs.ReadFile(fsys, "index.html") + if err != nil { + t.Fatal("index.html not found - run 'go generate' first") + } + + html := string(data) + + // Check it's NOT the source version + if strings.Contains(html, "/src/main.tsx") { + t.Fatal("Wrong index.html embedded: has /src/main.tsx (dev paths). The UI was not built. Run 'npm run build' first.") + } + + // Check it IS the built version + if !strings.Contains(html, "/assets/index-") { + t.Fatal("Wrong index.html embedded: missing /assets/index-* (production paths). The UI was not built correctly.") + } + + // Check assets directory exists + if _, err := fsys.Open("assets"); err != nil { + t.Fatal("assets/ directory not found - UI build incomplete") + } + + t.Log("Embedded assets verified - UI built correctly") +} +