plugins/tests/redis_test.go

25 lines
520 B
Go
Raw Permalink Normal View History

package tests
import (
2024-06-26 12:17:41 +08:00
"apigo.cc/apigo/gojs"
"apigo.cc/apigo/plugin"
_ "apigo.cc/apigo/plugins/redis"
"testing"
)
func TestRedis(t *testing.T) {
2024-03-24 12:28:02 +08:00
rdServer := StartRedis("16378")
defer rdServer.Close()
gojs.SetPluginsConfig(map[string]plugin.Config{
2024-06-26 12:17:41 +08:00
"apigo.cc/apigo/plugins/redis": {
2024-03-24 12:28:02 +08:00
"default": "redis://localhost:16378",
"configs": map[string]string{
"bak": "redis://localhost:16378/2",
},
},
})
2024-03-24 12:28:02 +08:00
r, err := gojs.RunFile("redis_test.js", nil)
Test(t, "get", r == true && err == nil, r, err)
}