mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-04 04:26:38 +08:00
优化
优化
This commit is contained in:
@@ -12,23 +12,23 @@ import (
|
||||
)
|
||||
|
||||
func TestEffectiveVersionPrefersBuildVersion(t *testing.T) {
|
||||
t.Setenv("MEDIASTATION_VERSION", "MediaStationGo-v0.1.15")
|
||||
t.Setenv("MMTL_VERSION", "MMTL-v0.1.15")
|
||||
|
||||
if got := effectiveVersion("MediaStationGo-v0.1.16"); got != "MediaStationGo-v0.1.16" {
|
||||
t.Fatalf("effectiveVersion = %q, want MediaStationGo-v0.1.16", got)
|
||||
if got := effectiveVersion("MMTL-v0.1.16"); got != "MMTL-v0.1.16" {
|
||||
t.Fatalf("effectiveVersion = %q, want MMTL-v0.1.16", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEffectiveVersionUsesEnvWhenBuildVersionIsDev(t *testing.T) {
|
||||
t.Setenv("MEDIASTATION_VERSION", " MediaStationGo-v0.1.16 ")
|
||||
t.Setenv("MMTL_VERSION", " MMTL-v0.1.16 ")
|
||||
|
||||
if got := effectiveVersion("dev"); got != "MediaStationGo-v0.1.16" {
|
||||
t.Fatalf("effectiveVersion = %q, want MediaStationGo-v0.1.16", got)
|
||||
if got := effectiveVersion("dev"); got != "MMTL-v0.1.16" {
|
||||
t.Fatalf("effectiveVersion = %q, want MMTL-v0.1.16", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEffectiveVersionDefaultsToDev(t *testing.T) {
|
||||
t.Setenv("MEDIASTATION_VERSION", "")
|
||||
t.Setenv("MMTL_VERSION", "")
|
||||
|
||||
if got := effectiveVersion(""); got != "dev" {
|
||||
t.Fatalf("effectiveVersion = %q, want dev", got)
|
||||
@@ -85,7 +85,7 @@ func TestServeSPAServesAssetsImmutableAndBypassesAPIRoutes(t *testing.T) {
|
||||
if err := os.WriteFile(filepath.Join(webDir, "assets", "app.js"), []byte("console.log('ok')"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(webDir, "brand", "mediastationgo-logo.svg"), []byte("<svg></svg>"), 0o644); err != nil {
|
||||
if err := os.WriteFile(filepath.Join(webDir, "brand", "mmtl-logo.svg"), []byte("<svg></svg>"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(webDir, "artwork-cache-sw.js"), []byte("self.addEventListener('fetch', () => {})"), 0o644); err != nil {
|
||||
@@ -105,7 +105,7 @@ func TestServeSPAServesAssetsImmutableAndBypassesAPIRoutes(t *testing.T) {
|
||||
t.Fatalf("asset Cache-Control = %q, want immutable", got)
|
||||
}
|
||||
|
||||
brandReq := httptest.NewRequest(http.MethodGet, "/brand/mediastationgo-logo.svg", nil)
|
||||
brandReq := httptest.NewRequest(http.MethodGet, "/brand/mmtl-logo.svg", nil)
|
||||
brandResp := httptest.NewRecorder()
|
||||
router.ServeHTTP(brandResp, brandReq)
|
||||
if brandResp.Code != http.StatusOK {
|
||||
|
||||
Reference in New Issue
Block a user