feat: add product archive frontend client

This commit is contained in:
2026-09-12 15:48:19 +08:00
parent cb5a46631b
commit dd3003609b
4 changed files with 203 additions and 0 deletions
@@ -0,0 +1,17 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
test('design preview serializes the complete visible document before PNG upload', async () => {
const source = await readFile(new URL('../src/lib/designPreview.ts', import.meta.url), 'utf8');
assert.match(source, /serializeDocument\(document, stickers, \{ includeBackground: true \}\)/);
assert.match(source, /canvas\.toBlob/);
});
test('archive client submits document JSON and a PNG preview as multipart data', async () => {
const source = await readFile(new URL('../src/lib/productArchive.ts', import.meta.url), 'utf8');
assert.match(source, /form\.append\('document_json'/);
assert.match(source, /form\.append\('preview'/);
});