Files
EdgeCommon/pkg/serverconfigs/server_name_config_test.go

46 lines
756 B
Go
Raw Permalink Normal View History

2021-02-07 09:08:06 +08:00
package serverconfigs
import (
"testing"
2024-07-27 13:29:26 +08:00
"github.com/iwind/TeaGo/logs"
2021-02-07 09:08:06 +08:00
)
func TestNormalizeServerNames(t *testing.T) {
serverNames := []*ServerNameConfig{
{
Name: "Hello.com",
SubNames: []string{"WoRld.com", "XYZ.com"},
},
}
NormalizeServerNames(serverNames)
logs.PrintAsJSON(serverNames, t)
}
func TestPlainServerNames(t *testing.T) {
serverNames := []*ServerNameConfig{
{
Name: "Hello.com",
SubNames: nil,
},
{
Name: "world.com",
SubNames: nil,
},
2022-04-14 15:21:20 +08:00
// duplicate
{
Name: "world.com",
SubNames: nil,
},
2021-02-07 09:08:06 +08:00
{
Name: "",
SubNames: []string{"WoRld.com", "XYZ.com"},
},
2022-04-14 15:21:20 +08:00
{
Name: "*.world.com",
SubNames: nil,
},
2021-02-07 09:08:06 +08:00
}
logs.PrintAsJSON(PlainServerNames(serverNames), t)
}