package globals import ( "testing" "go.uber.org/fx" "go.uber.org/fx/fxtest" ) // TestGlobalsNew ensures the globals package initializes correctly func TestGlobalsNew(t *testing.T) { app := fxtest.New(t, fx.Provide(New), fx.Invoke(func(g *Globals) { if g == nil { t.Fatal("Globals instance is nil") } if g.Appname != "vaultik" { t.Errorf("Expected Appname to be 'vaultik', got '%s'", g.Appname) } // Version and Commit will be "dev" and "unknown" by default if g.Version == "" { t.Error("Version should not be empty") } if g.Commit == "" { t.Error("Commit should not be empty") } }), ) app.RequireStart() app.RequireStop() }