import 'mocha';
import mochaDom = require('mocha-jsdom');
import { expect } from 'chai';
import * as fs from 'fs';
import * as path from 'path';
import { JSDOM } from 'jsdom';
import { snapshot, rebuild } from '../src';
const htmlFolder = path.join(__dirname, 'html');
const htmls = fs.readdirSync(htmlFolder).map(filePath => {
return {
filePath,
content: fs.readFileSync(path.resolve(htmlFolder, filePath), 'utf-8'),
};
});
describe('integration tests', () => {
mochaDom({ url: 'http://localhost' });
for (const html of htmls) {
it('[html file]:' + html.filePath, () => {
const dom = new JSDOM(html.content);
const snap = snapshot(dom.window.document);
const rebuildDom = rebuild(snap);
const htmlStr = dom.window.document.documentElement.outerHTML
.replace(/')
.replace(/