mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 20:40:25 +08:00
45 lines
755 B
Go
45 lines
755 B
Go
package serverconfigs
|
|
|
|
import (
|
|
"github.com/iwind/TeaGo/logs"
|
|
"testing"
|
|
)
|
|
|
|
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,
|
|
},
|
|
// duplicate
|
|
{
|
|
Name: "world.com",
|
|
SubNames: nil,
|
|
},
|
|
{
|
|
Name: "",
|
|
SubNames: []string{"WoRld.com", "XYZ.com"},
|
|
},
|
|
{
|
|
Name: "*.world.com",
|
|
SubNames: nil,
|
|
},
|
|
}
|
|
logs.PrintAsJSON(PlainServerNames(serverNames), t)
|
|
}
|