Mining/pkg/mining/version_test.go
Claude 63a9107f9c
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
ax(batch): add missing test files and fix pre-existing test compilation errors
Adds test files for 6 source files that had no corresponding test:
bufpool_test.go (mining + node), metrics_test.go, version_test.go,
supervisor_test.go, mining_profile_test.go. Each follows
TestFilename_Function_{Good,Bad,Ugly} convention.

Also fixes 2 pre-existing compilation errors:
- ratelimiter_test.go: rl -> rateLimiter (leftover from AX rename)
- worker_test.go: worker.node -> worker.nodeManager (field was renamed)

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:30:42 +01:00

31 lines
712 B
Go

package mining
import (
"testing"
)
func TestVersion_GetVersion_Good(t *testing.T) {
result := GetVersion()
if result == "" {
t.Fatal("expected non-empty version string")
}
}
func TestVersion_GetVersion_Bad(t *testing.T) {
// Default version is "dev" when ldflags are not set
result := GetVersion()
if result != "dev" {
// Not a failure — just means ldflags were set
t.Logf("version is %q (ldflags may be set)", result)
}
}
func TestVersion_GetVersion_Ugly(t *testing.T) {
// All three version functions should return non-empty strings
if GetCommit() == "" {
t.Fatal("expected non-empty commit string")
}
if GetBuildDate() == "" {
t.Fatal("expected non-empty build date string")
}
}