Files
wordcloud/frontend/tests/product-archive-ui.test.mjs
T

18 lines
764 B
JavaScript

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'/);
});