package host import ( "github.com/carlosframework/platform/internal/hostclaim" "github.com/carlosframework/platform/internal/park" "testing" "time" ) func TestPlan13MoveQuietReadsLegacyAndHomeToken(t *testing.T) { now := time.Unix(100, 0) for _, stored := range []string{"ie", park.HomeRegion, "uk"} { o := hostclaim.Observed{Claim: &hostclaim.Claim{Op: hostclaim.Op{Intent: map[string]string{"home_region": "ie"}}, QuietAfter: map[string]time.Time{stored: now.Add(time.Hour)}}} got := checkQuiet(o, park.HomeRegion, now) if got.OK != (stored == "uk") { t.Fatalf("%q: %+v", stored, got) } got = checkQuiet(o, "uk", now) if got.OK != (stored != "uk") { t.Fatalf("named %q: %+v", stored, got) } } }