oficina / mapa Public

L7: paging the month calendar writes nothing

Fable's final review of 58fd476, a Low: L7 had no row-hash case for
?month=. TestL7TheMonthCalendarWritesNothing pages it, as Ana and Bo, on
a written day, an unwritten one and Today, with this month, months away
and a value that is not a month, and compares the row dump; a write
afterwards proves the dump is not vacuous. A member row written only
under ?month= (tried by hand) turns it red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 6d2a089f9eb41e845ae943fb2bc0ce3a5633b567 parent 3df8f5d
1 file changed, +38 −0
  • internal/mapatest/calendar_l7_test.go +38 −0
diff --git a/internal/mapatest/calendar_l7_test.go b/internal/mapatest/calendar_l7_test.go
new file mode 100644
index 0000000..91c609d
--- /dev/null
+++ b/internal/mapatest/calendar_l7_test.go
@@ -0,0 +1,38 @@
+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")
+ }
+}