- Remove StartTime initialization from globals.New() - Add setupGlobals function in app.go to set StartTime during fx OnStart - Simplify globals package to be just a key/value store - Remove fx dependencies from globals test
31 lines
582 B
Go
31 lines
582 B
Go
package globals
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// TestGlobalsNew ensures the globals package initializes correctly
|
|
func TestGlobalsNew(t *testing.T) {
|
|
g, err := New()
|
|
if err != nil {
|
|
t.Fatalf("Failed to create Globals: %v", err)
|
|
}
|
|
|
|
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")
|
|
}
|
|
}
|