2024-07-27 14:15:25 +08:00
|
|
|
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
|
2022-06-05 17:13:56 +08:00
|
|
|
|
|
|
|
|
package services
|
|
|
|
|
|
|
|
|
|
import (
|
2024-07-27 14:15:25 +08:00
|
|
|
"testing"
|
|
|
|
|
|
2022-09-23 09:28:19 +08:00
|
|
|
"github.com/TeaOSLab/EdgeAPI/internal/utils"
|
2022-06-05 17:13:56 +08:00
|
|
|
"github.com/iwind/TeaGo/assert"
|
|
|
|
|
)
|
|
|
|
|
|
2022-09-23 09:28:19 +08:00
|
|
|
func TestHTTPCacheTaskService_ParseDomain(t *testing.T) {
|
2022-06-05 17:13:56 +08:00
|
|
|
var a = assert.NewAssertion(t)
|
|
|
|
|
|
2022-09-23 09:28:19 +08:00
|
|
|
a.IsTrue(utils.ParseDomainFromKey("aaa") == "aaa")
|
|
|
|
|
a.IsTrue(utils.ParseDomainFromKey("AAA") == "aaa")
|
|
|
|
|
a.IsTrue(utils.ParseDomainFromKey("a.b-c.com") == "a.b-c.com")
|
|
|
|
|
a.IsTrue(utils.ParseDomainFromKey("a.b-c.com/hello/world") == "a.b-c.com")
|
|
|
|
|
a.IsTrue(utils.ParseDomainFromKey("https://a.b-c.com") == "a.b-c.com")
|
|
|
|
|
a.IsTrue(utils.ParseDomainFromKey("http://a.b-c.com/hello/world") == "a.b-c.com")
|
|
|
|
|
a.IsTrue(utils.ParseDomainFromKey("http://a.B-c.com/hello/world") == "a.b-c.com")
|
|
|
|
|
a.IsTrue(utils.ParseDomainFromKey("http:/aaaa.com") == "http")
|
|
|
|
|
a.IsTrue(utils.ParseDomainFromKey("北京") == "")
|
2022-06-05 17:13:56 +08:00
|
|
|
}
|