package mapatest import ( "net/http" "net/url" "strings" "testing" ) // L7 for the month calendar (review L): paging it with ?month= is a GET // and writes nothing, on a written day, an unwritten one and Today, with // a month, a month away and a value that is not a month. The row dump // is compared, not the file. func TestL7TheMonthCalendarWritesNothing(t *testing.T) { rig := newRig(t) rig.post(t, Ana, "/d/2026-11-10", url.Values{"body": {"Written."}}) before := dumpAll(t, rig) for _, who := range []string{Ana, Bo} { for _, day := range []string{"/d/2026-11-10", "/d/2026-11-20", "/"} { for _, month := range []string{"2026-11", "2026-10", "2027-01", "nonsense"} { path := day + "?month=" + month got := rig.fetchAs(who, path, nil) if got.Code != http.StatusOK || !strings.Contains(got.Body.String(), "month=") { t.Fatalf("%s GET %s: %d", who, path, got.Code) } } } } if dumpAll(t, rig) != before { t.Fatal("paging the month calendar wrote to the database") } rig.post(t, Ana, "/d/2026-11-20", url.Values{"body": {"Now written."}}) if dumpAll(t, rig) == before { t.Fatal("the dump is vacuous: writing a day did not change it") } }