31 lines
610 B
Go
31 lines
610 B
Go
package globals
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"go.uber.org/fx/fxtest"
|
|
)
|
|
|
|
func TestNew(t *testing.T) {
|
|
// Set test values
|
|
Appname = "test-app"
|
|
Version = "1.0.0"
|
|
Buildarch = "test-arch"
|
|
|
|
lc := fxtest.NewLifecycle(t)
|
|
globals, err := New(lc)
|
|
if err != nil {
|
|
t.Fatalf("New() error = %v", err)
|
|
}
|
|
|
|
if globals.Appname != "test-app" {
|
|
t.Errorf("Appname = %v, want %v", globals.Appname, "test-app")
|
|
}
|
|
if globals.Version != "1.0.0" {
|
|
t.Errorf("Version = %v, want %v", globals.Version, "1.0.0")
|
|
}
|
|
if globals.Buildarch != "test-arch" {
|
|
t.Errorf("Buildarch = %v, want %v", globals.Buildarch, "test-arch")
|
|
}
|
|
}
|