Files
pages/internal/server/managed_campus_test.go
T
Anya Tokugawa c1175d389f Implement Knowledge City platform, organizer and DAV integration
Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming.

Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
2026-09-27 14:44:43 +09:00

29 lines
667 B
Go

package server
import (
"testing"
"time"
"pageswiki/internal/store"
)
func TestManagedCampusOnlineUsesRecentAuthenticatedContact(t *testing.T) {
now := time.Unix(1000, 0)
campus := store.Campus{
AuthorityMode: "managed",
LastContactAt: now.Unix() - 5,
}
if !managedCampusOnline(campus, now) {
t.Fatal("recent authenticated contact was shown offline")
}
campus.LastContactError = "controller unavailable"
if managedCampusOnline(campus, now) {
t.Fatal("failed contact was shown online")
}
campus.LastContactError = ""
campus.LastContactAt = now.Unix() - 16
if managedCampusOnline(campus, now) {
t.Fatal("stale contact was shown online")
}
}