mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			919 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			919 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2022 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
						|
 | 
						|
package services
 | 
						|
 | 
						|
import (
 | 
						|
	"github.com/TeaOSLab/EdgeAPI/internal/utils"
 | 
						|
	"github.com/iwind/TeaGo/assert"
 | 
						|
	"testing"
 | 
						|
)
 | 
						|
 | 
						|
func TestHTTPCacheTaskService_ParseDomain(t *testing.T) {
 | 
						|
	var a = assert.NewAssertion(t)
 | 
						|
 | 
						|
	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("北京") == "")
 | 
						|
}
 |