mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 06:36:38 +08:00
f2ab94501c
- Relocated go.mod and go.sum into backend/ root directory - Stripped redundant backend/ segments from all Go imports (github.com/Rain-kl/Wavelet/...) - Unified Makefile, swagger, and build-test to execute in backend/ module context - Ensured 100% build-test, code-check, format, and swagger pass
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/Rain-kl/Wavelet/pkg/buildinfo"
|
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
|
)
|
|
|
|
func TestFormatStartupBanner(t *testing.T) {
|
|
previousVersion := buildinfo.Version
|
|
previousBuildTime := buildinfo.BuildTime
|
|
previousEnv := config.Config.App.Env
|
|
previousAddr := config.Config.App.Addr
|
|
t.Cleanup(func() {
|
|
buildinfo.Version = previousVersion
|
|
buildinfo.BuildTime = previousBuildTime
|
|
config.Config.App.Env = previousEnv
|
|
config.Config.App.Addr = previousAddr
|
|
})
|
|
|
|
buildinfo.Version = "v3.2.1"
|
|
buildinfo.BuildTime = "2026-07-13T08:00:00Z"
|
|
config.Config.App.Env = "production"
|
|
config.Config.App.Addr = ":3000"
|
|
|
|
banner := formatStartupBanner(startupState{
|
|
mode: "API",
|
|
listensForHTTP: true,
|
|
})
|
|
|
|
for _, want := range []string{
|
|
"Wavelet v3.2.1",
|
|
"Environment: production",
|
|
"Build time: 2026-07-13T08:00:00Z",
|
|
"Listening: http://:3000",
|
|
"Mode: API",
|
|
} {
|
|
if !strings.Contains(banner, want) {
|
|
t.Errorf("banner missing %q:\n%s", want, banner)
|
|
}
|
|
}
|
|
}
|