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 <noreply@anthropic.com>
This commit is contained in:
bchanotandClaude committed 2026-11-16 14:30:34 +01:00
1 parent e3495df088
commit a76a54dbb7
1 file changed
+6 -1
+6 -1
View File
@@ -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');