mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-14 03:52:26 +08:00
test(web): use shipped SVG asset in embedded frontend tests
This commit is contained in:
@@ -653,11 +653,11 @@ func TestFrontendServer_Middleware(t *testing.T) {
|
||||
|
||||
// Request for existing static file
|
||||
w := httptest.NewRecorder()
|
||||
req := httptest.NewRequest(http.MethodGet, "/logo.png", nil)
|
||||
req := httptest.NewRequest(http.MethodGet, "/logo.svg", nil)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
assert.Equal(t, http.StatusOK, w.Code)
|
||||
assert.Contains(t, w.Header().Get("Content-Type"), "image/png")
|
||||
assert.Contains(t, w.Header().Get("Content-Type"), "image/svg+xml")
|
||||
assert.Empty(t, w.Header().Get("Cache-Control"))
|
||||
|
||||
entries, err := fs.ReadDir(server.distFS, "assets")
|
||||
@@ -772,11 +772,11 @@ func TestServeEmbeddedFrontend(t *testing.T) {
|
||||
router.Use(middleware)
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
req := httptest.NewRequest(http.MethodGet, "/logo.png", nil)
|
||||
req := httptest.NewRequest(http.MethodGet, "/logo.svg", nil)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
assert.Equal(t, http.StatusOK, w.Code)
|
||||
assert.Contains(t, w.Header().Get("Content-Type"), "image/png")
|
||||
assert.Contains(t, w.Header().Get("Content-Type"), "image/svg+xml")
|
||||
})
|
||||
|
||||
t.Run("serves_index_html_for_root", func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user