Files
tx-sync/internal/config/config_test.go
T
jamie 38dc37149c
tx-sync build / build (tx-sync-linux-amd64, amd64, linux) (push) Failing after 50s
tx-sync build / build (tx-sync-windows-amd64.exe, amd64, windows) (push) Failing after 6s
feat: initial commit
2026-03-21 01:02:52 +00:00

30 lines
542 B
Go

package config
import (
"testing"
"time"
)
func TestConfigValidate(t *testing.T) {
c := Config{
Endpoint: "https://example.com/api/ingest",
APIKey: "k",
PlayersDBPath: "/data/playersDB.json",
SyncInterval: "5m",
}
if err := c.Validate(); err != nil {
t.Fatal(err)
}
d, err := c.IntervalDuration()
if err != nil || d != 5*time.Minute {
t.Fatalf("interval: %v %v", d, err)
}
}
func TestConfigValidateEmpty(t *testing.T) {
var c Config
if err := c.Validate(); err == nil {
t.Fatal("expected error")
}
}