feat: add canvas product archive flow
This commit is contained in:
@@ -15,3 +15,42 @@ test('archive client submits document JSON and a PNG preview as multipart data',
|
||||
assert.match(source, /form\.append\('document_json'/);
|
||||
assert.match(source, /form\.append\('preview'/);
|
||||
});
|
||||
|
||||
test('canvas offers a product archive action and reports detected source count', async () => {
|
||||
const canvas = await readFile(new URL('../src/pages/CanvasStudio.tsx', import.meta.url), 'utf8');
|
||||
const dialog = await readFile(new URL('../src/components/ProductArchiveDialog.tsx', import.meta.url), 'utf8');
|
||||
|
||||
assert.match(canvas, /加入产品列表/);
|
||||
assert.match(dialog, /已检测到.*份画布词云/);
|
||||
assert.match(dialog, /将作为产品封面/);
|
||||
});
|
||||
|
||||
test('archive dialog states the server scan is authoritative and covers zero-source drafts', async () => {
|
||||
const dialog = await readFile(new URL('../src/components/ProductArchiveDialog.tsx', import.meta.url), 'utf8');
|
||||
|
||||
assert.match(dialog, /(以服务端扫描为准|服务端扫描为最终依据|最终归档数量以服务端为准)/);
|
||||
assert.match(dialog, /无词云归档数据/);
|
||||
});
|
||||
|
||||
test('archive success hides raw identifiers and reports the archived count', async () => {
|
||||
const canvas = await readFile(new URL('../src/pages/CanvasStudio.tsx', import.meta.url), 'utf8');
|
||||
|
||||
assert.match(canvas, /已归档至产品/);
|
||||
assert.match(canvas, /份词云位置数据已长期保存/);
|
||||
assert.doesNotMatch(canvas, /已归档至产品.*\{product\.product_id\}/);
|
||||
});
|
||||
|
||||
test('archive status styles cover archived, empty and pending cleanup states', async () => {
|
||||
const styles = await readFile(new URL('../src/styles.css', import.meta.url), 'utf8');
|
||||
|
||||
assert.match(styles, /\.product-status-archived/);
|
||||
assert.match(styles, /\.product-status-empty/);
|
||||
assert.match(styles, /\.product-status-pending-cleanup/);
|
||||
});
|
||||
|
||||
test('new product creation archives with the created product id instead of a draft id', async () => {
|
||||
const dialog = await readFile(new URL('../src/components/ProductArchiveDialog.tsx', import.meta.url), 'utf8');
|
||||
|
||||
assert.match(dialog, /await createManualProduct\(token, \{ name, sku, specification \}\)/);
|
||||
assert.match(dialog, /archiveProductVersion\(token, product\.product_id, document, previewBlob\)/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user