From a76a54dbb78bc518b0c815d85d115b1d97aa4611 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 16 Nov 2026 14:30:34 +0100 Subject: [PATCH] test(supabase): pgTAP 022 covers a sheet row newer than its versions Plan 72 to 73. Fails under coalesce(max(version), sheet), passes under greatest. Co-Authored-By: Claude --- supabase/tests/022_sheet_admin_reads.sql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/supabase/tests/022_sheet_admin_reads.sql b/supabase/tests/022_sheet_admin_reads.sql index 7587b3d0..efea1a88 100644 --- a/supabase/tests/022_sheet_admin_reads.sql +++ b/supabase/tests/022_sheet_admin_reads.sql @@ -4,7 +4,7 @@ -- unknown, deleted, personal or forbidden sheet gets one answer. Fixtures are -- scoped to the ids created here. begin; -select plan(72); +select plan(73); -- Accounts. O owner, A admin, E admin + editor, V reviewer, P admin + -- publisher, R reader, N no right. Every one has a verified factor and a live @@ -227,6 +227,11 @@ select is((public.get_official_sheet_admin(pg_temp.id('WK')) ->> 'working_copy') 'the dated fixture is a working copy'); select is(pg_temp.at('WK', 'last_modified_at'), '2026-01-04T10:00:00Z'::timestamptz, 'a working copy is dated by its own draft'); +reset role; +update public.anatomical_sheets set name = 'WK 2' where id = pg_temp.id('WK'); +select pg_temp.as_user('E', 'aal2'); +select is(pg_temp.at('WK', 'last_modified_at'), now(), + 'a sheet change newer than its versions gives the sheet''s date'); select is(pg_temp.val($$ select public.save_sheet_draft(pg_temp.id('WK.v1'), 0, pg_temp.doc('Copie datée 2'), 'r3') ->> 'revision' $$), '1', 'E saves the working copy''s draft'); select is(pg_temp.at('WK', 'last_modified_at'), now(), 'a working copy''s draft save moves its last_modified_at');