diff --git a/packages/supabase/tests/sandbox/sheets-admin.sandbox.ts b/packages/supabase/tests/sandbox/sheets-admin.sandbox.ts index f37d319f..20f99793 100644 --- a/packages/supabase/tests/sandbox/sheets-admin.sandbox.ts +++ b/packages/supabase/tests/sandbox/sheets-admin.sandbox.ts @@ -181,8 +181,14 @@ describe('administration reads, species and account lookup', () => { it('the working copy and the catalogue reads answer their closed kinds', async () => { const source = await sql(`select id from public.anatomical_sheet_versions where sheet_id = '${HISTORICAL}' order by version_number limit 1`) - expect(['working_copy.exists', 'working_copy.assets_missing']) - .toContain(await kindOf(createSheetWorkingCopy(editorAal2, source, `wc-${randomUUID().slice(0, 8)}`))) + // A fresh sandbox has no working copy yet, so the first call may create it: both outcomes are valid. + const name = () => `wc-${randomUUID().slice(0, 8)}` + const first = await kindOf(createSheetWorkingCopy(editorAal2, source, name())) + if (first === 'no failure') { + expect(await kindOf(createSheetWorkingCopy(editorAal2, source, name()))).toBe('working_copy.exists') + } else { + expect(['working_copy.exists', 'working_copy.assets_missing']).toContain(first) + } const versions = await listSheetVersions(editorAal2, HISTORICAL) expect(versions.every((v) => v.status === 'published' || v.status === 'deprecated')).toBe(true) expect(await kindOf(downloadSheetDrawing(editorAal2, 'f'.repeat(64)))).toBe('not_found')