go-proxy/configwatcher_test.go
Virgil 86c07943b0 fix(proxy): align watcher and HTTP payloads
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-04 20:45:37 +00:00

23 lines
519 B
Go

package proxy
import (
"os"
"path/filepath"
"testing"
)
func TestConfigWatcher_New_Good(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "config.json")
if err := os.WriteFile(path, []byte(`{"mode":"nicehash"}`), 0o644); err != nil {
t.Fatalf("write config file: %v", err)
}
watcher := NewConfigWatcher(path, func(*Config) {})
if watcher == nil {
t.Fatal("expected watcher")
}
if watcher.lastMod.IsZero() {
t.Fatal("expected last modification time to be initialised from the file")
}
}