loom/test/html-to-ast.test.mjs

16 lines
431 B
JavaScript

import htmlToAst from '../src/html-to-ast.mjs';
import htmlAstMapping from './fixtures/html-ast.fixture.mjs';
describe("html-to-ast", () => {
it("html should be converted to a UnifiedJS AST", () => {
expect(htmlToAst).toBeDefined();
// Loop through all the mappings of html to AST and make sure they work.
for (const [html, ast] of Object.entries(htmlAstMapping)) {
expect(htmlToAst(html)).toEqual(ast);
}
});
});