18 lines
547 B
18 lines
547 B
const expect = require("chai").expect;
|
|
const CompileReact = require("../lib/compileReact");
|
|
const { render, screen } = require("@testing-library/react");
|
|
// require("@testing-library/jest-dom/extend-expect");
|
|
require("jsdom");
|
|
|
|
describe("Compile AST to REACT elements", function () {
|
|
it("Simple react elements", function () {
|
|
const ast = [
|
|
{
|
|
type: "underline",
|
|
children: ["The ", { type: "bold", children: ["Apple"] }],
|
|
},
|
|
];
|
|
render(CompileReact(ast));
|
|
expect(screen.getByText("Apple")).toHaveTextContent("Apple");
|
|
});
|
|
});
|
|
|