2021-12-30 02:10:28 +01:00
|
|
|
import path from 'path';
|
2022-01-02 19:37:33 +01:00
|
|
|
import fs from 'fs';
|
|
|
|
import { expect, test } from '@jest/globals'; // Workaround for cypress conflict
|
2021-12-30 02:10:28 +01:00
|
|
|
import SVGExporter from '../../../src/components/export/SVGExporter';
|
2022-01-02 19:37:33 +01:00
|
|
|
import { parseXMLFile, setupBlob, exporterAssert } from './Helper';
|
|
|
|
|
|
|
|
setupBlob();
|
|
|
|
|
|
|
|
describe('SVG export test execution', () => {
|
2022-07-13 03:45:36 +02:00
|
|
|
test.each(
|
|
|
|
fs
|
|
|
|
.readdirSync(path.resolve(__dirname, './input/'))
|
|
|
|
.filter((f) => f.endsWith('.wxml'))
|
|
|
|
.map((filename: string) => filename.split('.')[0]),
|
|
|
|
)('Exporting %p suite', async (testName: string) => {
|
2022-01-24 20:24:16 +01:00
|
|
|
// Load SVG ...
|
|
|
|
const svgPath = path.resolve(__dirname, `./input/${testName}.svg`);
|
|
|
|
expect(fs.existsSync(svgPath)).toEqual(true);
|
|
|
|
const svgDocument = parseXMLFile(svgPath, 'image/svg+xml');
|
2022-01-02 19:37:33 +01:00
|
|
|
|
2022-01-24 20:24:16 +01:00
|
|
|
// Generate output ...
|
2022-02-02 04:13:44 +01:00
|
|
|
const exporter = new SVGExporter(svgDocument.documentElement);
|
2022-01-24 20:24:16 +01:00
|
|
|
await exporterAssert(testName, exporter);
|
|
|
|
});
|
2021-12-30 02:10:28 +01:00
|
|
|
});
|