From 7534d7d178e738dd6e2b68c7d23f57cdb1823f19 Mon Sep 17 00:00:00 2001 From: Mischa Date: Sun, 5 Jul 2026 20:14:50 +0200 Subject: [PATCH] test(post-form): expect zero-padded photo-01..NN filenames The create path now routes through the shared PhotoRenumberer, which zero-pads to photo-01..NN; update the Playwright assertions and title to match the new naming. Co-Authored-By: Claude Opus 4.8 --- tests/ui/post/post-form-ux.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/ui/post/post-form-ux.spec.js b/tests/ui/post/post-form-ux.spec.js index ad9b167..720c5e1 100644 --- a/tests/ui/post/post-form-ux.spec.js +++ b/tests/ui/post/post-form-ux.spec.js @@ -107,8 +107,8 @@ test('photo section auto-collapses to a summary after upload and re-expands on t await expect(details).toHaveJSProperty('open', true); }); -// ── Reorder: uploaded photos are renamed photo-1..N; no order field leaks ────── -test('uploaded photos are renamed photo-1..N and the order field never hits frontmatter', async ({ page }) => { +// ── Reorder: uploaded photos are renamed photo-01..NN; no order field leaks ──── +test('uploaded photos are renamed photo-01..NN and the order field never hits frontmatter', async ({ page }) => { const tag = `rename-${Date.now()}`; await page.goto('/post'); await page.fill('input[name="data[title]"]', `UI Test ${tag}`); @@ -124,9 +124,9 @@ test('uploaded photos are renamed photo-1..N and the order field never hits fron const dir = findEntry(tag); expect(dir, 'Entry folder should exist').toBeTruthy(); const files = fs.readdirSync(dir); - // Server renamed both uploads to the deterministic photo-N scheme (drag order). - expect(files).toContain('photo-1.jpg'); - expect(files).toContain('photo-2.jpg'); + // Server renamed both uploads to the deterministic zero-padded photo-NN scheme (drag order). + expect(files).toContain('photo-01.jpg'); + expect(files).toContain('photo-02.jpg'); // The order is sent as a top-level POST key, so it must not appear in frontmatter. const mdName = files.find(f => /\.md$/.test(f));