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 <noreply@anthropic.com>
This commit is contained in:
2026-07-05 20:14:50 +02:00
co-authored by Claude Opus 4.8
parent 8441ce392d
commit 7534d7d178
+5 -5
View File
@@ -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); await expect(details).toHaveJSProperty('open', true);
}); });
// ── Reorder: uploaded photos are renamed photo-1..N; no order field leaks ────── // ── Reorder: uploaded photos are renamed photo-01..NN; no order field leaks ────
test('uploaded photos are renamed photo-1..N and the order field never hits frontmatter', async ({ page }) => { test('uploaded photos are renamed photo-01..NN and the order field never hits frontmatter', async ({ page }) => {
const tag = `rename-${Date.now()}`; const tag = `rename-${Date.now()}`;
await page.goto('/post'); await page.goto('/post');
await page.fill('input[name="data[title]"]', `UI Test ${tag}`); 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); const dir = findEntry(tag);
expect(dir, 'Entry folder should exist').toBeTruthy(); expect(dir, 'Entry folder should exist').toBeTruthy();
const files = fs.readdirSync(dir); const files = fs.readdirSync(dir);
// Server renamed both uploads to the deterministic photo-N scheme (drag order). // Server renamed both uploads to the deterministic zero-padded photo-NN scheme (drag order).
expect(files).toContain('photo-1.jpg'); expect(files).toContain('photo-01.jpg');
expect(files).toContain('photo-2.jpg'); expect(files).toContain('photo-02.jpg');
// The order is sent as a top-level POST key, so it must not appear in frontmatter. // 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)); const mdName = files.find(f => /\.md$/.test(f));