mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
``` git ls-files \*.js \*.go \ | xargs sed -i '1i // SPDX-FileCopyrightText: 2022 Free Mobile\n// SPDX-License-Identifier: AGPL-3.0-only\n' git ls-files \*.vue \ | xargs sed -i '1i <!-- SPDX-FileCopyrightText: 2022 Free Mobile -->\n<!-- SPDX-License-Identifier: AGPL-3.0-only -->\n' ```
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
// SPDX-FileCopyrightText: 2022 Free Mobile
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package console
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"akvorado/common/helpers"
|
|
)
|
|
|
|
func TestServeAssets(t *testing.T) {
|
|
for _, live := range []bool{false, true} {
|
|
var name string
|
|
switch live {
|
|
case true:
|
|
name = "livefs"
|
|
case false:
|
|
name = "embeddedfs"
|
|
}
|
|
t.Run(name, func(t *testing.T) {
|
|
conf := DefaultConfiguration()
|
|
conf.ServeLiveFS = live
|
|
_, h, _, _ := NewMock(t, conf)
|
|
|
|
helpers.TestHTTPEndpoints(t, h.Address, helpers.HTTPEndpointCases{
|
|
{
|
|
URL: "/",
|
|
ContentType: "text/html; charset=utf-8",
|
|
FirstLines: []string{"<!DOCTYPE html>"},
|
|
}, {
|
|
URL: "/something",
|
|
ContentType: "text/html; charset=utf-8",
|
|
FirstLines: []string{"<!DOCTYPE html>"},
|
|
}, {
|
|
URL: "/assets/akvorado.399701ee.svg",
|
|
ContentType: "image/svg+xml",
|
|
FirstLines: []string{`<?xml version="1.0" encoding="UTF-8" standalone="no"?>`},
|
|
}, {
|
|
URL: "/assets/somethingelse.svg",
|
|
StatusCode: 404,
|
|
ContentType: "text/plain; charset=utf-8",
|
|
FirstLines: []string{"404 page not found"},
|
|
},
|
|
})
|
|
})
|
|
}
|
|
}
|