check / check (push) Successful in 2m0s
The header drew the host's local time and then America/Los_Angeles time, so on a Mac in that zone both clocks read the same and neither was UTC. The first clock is now UTC and the second the host's local time, which also drops the hardcoded zone and its load-failure path.
28 lines
670 B
Go
28 lines
670 B
Go
package monitor_test
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"git.eeqj.de/sneak/rtnetmon/internal/monitor"
|
|
)
|
|
|
|
// TestClockStrings checks that the header shows UTC first and the host's
|
|
// local time second, so the two differ whenever the host is not on UTC.
|
|
func TestClockStrings(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
berlin := time.FixedZone("CET", 3600)
|
|
now := time.Date(2026, time.November, 6, 20, 30, 0, 0, berlin)
|
|
|
|
utc, local := monitor.ClockStrings(now)
|
|
|
|
if want := "Fri, 06 Nov 2026 19:30:00 +0000"; utc != want {
|
|
t.Errorf("utc = %q, want %q", utc, want)
|
|
}
|
|
|
|
if want := "Fri, 06 Nov 2026 20:30:00 +0100"; local != want {
|
|
t.Errorf("local = %q, want %q", local, want)
|
|
}
|
|
}
|