github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/kvstore/utils_test.go (about) 1 // Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . 2 3 package kvstore_test 4 5 import ( 6 "github.com/TeaOSLab/EdgeNode/internal/utils/kvstore" 7 "github.com/iwind/TeaGo/Tea" 8 "github.com/iwind/TeaGo/assert" 9 _ "github.com/iwind/TeaGo/bootstrap" 10 "testing" 11 ) 12 13 func TestRemoveDB(t *testing.T) { 14 err := kvstore.RemoveStore(Tea.Root + "/data/stores/test2.store") 15 if err != nil { 16 t.Fatal(err) 17 } 18 } 19 20 func TestIsValidName(t *testing.T) { 21 var a = assert.NewAssertion(t) 22 23 a.IsTrue(kvstore.IsValidName("a")) 24 a.IsTrue(kvstore.IsValidName("aB")) 25 a.IsTrue(kvstore.IsValidName("aBC1")) 26 a.IsTrue(kvstore.IsValidName("aBC1._-")) 27 a.IsFalse(kvstore.IsValidName(" aBC1._-")) 28 a.IsFalse(kvstore.IsValidName("")) 29 }