go-scopes/tests/scopes_test.go

28 lines
645 B
Go

package scopes_test
import (
tbase "testing"
"git.sr.ht/~cco/go-scopes"
"git.sr.ht/~cco/go-scopes/common"
"git.sr.ht/~cco/go-scopes/config"
"git.sr.ht/~cco/go-scopes/testing"
"git.sr.ht/~cco/go-scopes/tests/etc"
)
func TestConfig(tb *tbase.T) {
t := testing.SetUp(tb)
cfg := config.Setup(etc.Config())
t.Ctx = common.AppContext(cfg)
cfg.Starter()(t.Ctx)
t.Run("config", ConfigTest)
}
func ConfigTest(t *testing.T) {
cfg := etc.Config()
t.AssertEqual(cfg.Name(), "dummy")
appCfg := cfg.(*scopes.Cfg)
t.AssertEqual(appCfg.Home, "tests")
confCtx := t.Ctx.Services()["config"]
t.AssertEqual(confCtx.Config().Name(), "config")
}