mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-11 01:43:23 +01:00
22 lines
937 B
TypeScript
22 lines
937 B
TypeScript
/* eslint-disable import/no-extraneous-dependencies */
|
|
/* eslint-disable import/prefer-default-export */
|
|
import path from 'path';
|
|
import { expect } from '@jest/globals';
|
|
import Importer from '../../../src/components/import/Importer';
|
|
import XMLSerializerFactory from '../../../src/components/persistence/XMLSerializerFactory';
|
|
import { parseXMLFile } from '../export/Helper';
|
|
|
|
export const exporterAssert = async (testName: string, importer: Importer) => {
|
|
const actualMindmap = await importer.import(testName, '');
|
|
|
|
// Load mindmap DOM..
|
|
const mindmapPath = path.resolve(__dirname, `./expected/${testName}.wxml`);
|
|
const mindmapMapDocument = parseXMLFile(mindmapPath, 'text/xml');
|
|
|
|
// Convert to mindmap...
|
|
const serializer = XMLSerializerFactory.createInstanceFromDocument(mindmapMapDocument);
|
|
const mindmapExpect = serializer.loadFromDom(mindmapMapDocument, testName);
|
|
|
|
expect(actualMindmap).toEqual(mindmapExpect);
|
|
};
|