package app import ( "testing" "github.com/Nwflower/reims-go/internal/config" ) // Before first-run setup a.cfg only suggests a data folder: the market must // not cache into it, nor keep a client bound to it past setup. func TestPluginMarketBeforeSetupIsThrowaway(t *testing.T) { a := &App{cfg: &config.Config{DataRoot: t.TempDir()}, needsSetup: true} if a.getPluginMarket() == a.getPluginMarket() || a.pluginMarket != nil { t.Fatal("market client was kept before setup") } a.needsSetup = false if c := a.getPluginMarket(); c == nil || c != a.pluginMarket || c != a.getPluginMarket() { t.Fatal("market client is not cached after setup") } } func TestBuiltinCoversLocale(t *testing.T) { for tag, want := range map[string]bool{ "": true, "en-US": true, "en-GB": true, "zh-CN": true, "zh-SG": true, "zh-Hans": true, "zh-TW": false, // Traditional script needs a pack "zh-HK": false, "ko-KR": false, "ja-JP": false, } { if got := builtinCoversLocale(tag); got != want { t.Errorf("builtinCoversLocale(%q) = %v, want %v", tag, got, want) } } }