mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 14:06:36 +08:00
528240026d
- make format 现在与 code-check 使用同一格式化器(golangci-lint fmt),消除 goimports -local 与 gofumpt 的格式拉锯 - .golangci.yml 关闭默认 50/3 截断,完整上报所有问题(只增强不弱化) - 全库 gofumpt 规范化(203 files, 纯格式无行为变更)
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"Wavelet/pkg/buildinfo"
|
|
"Wavelet/pkg/config"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
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)
|
|
}
|
|
}
|
|
}
|