wisemapping-frontend/packages/mindplot/test/unit/export/SVGExporterTestSuite.test.ts

23 lines
895 B
TypeScript
Raw Normal View History

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', () => {
test.each(fs.readdirSync(path.resolve(__dirname, './input/'))
.filter((f) => f.endsWith('.wxml'))
2022-01-24 20:24:16 +01:00
.map((filename: string) => filename.split('.')[0]))('Exporting %p suite', async (testName: string) => {
// 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
});