Skip to content

Commit

Permalink
refactor(test): replaces chai with node:asserti II - extract/parse
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij committed Aug 5, 2023
1 parent c92f41a commit 80fe5a6
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions test/extract/parse/to-javascript-ast.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { strictEqual } from "node:assert";
import { expect } from "chai";
import get from "lodash/get.js";
import { getASTFromSource } from "../../../src/extract/parse/to-javascript-ast.mjs";

Expand Down Expand Up @@ -38,13 +37,14 @@ describe("[U] extract/parse/to-javascript-ast", () => {
},
},
);
expect(
strictEqual(
get(
lFoundAST,
"body[0].declarations[0].init.body.type",
"not a jsx element",
),
).to.equal("JSXElement");
"JSXElement",
);
});

it("doesn't have any weird imports when tsx gets transpiled as non-'preserve' ", () => {
Expand Down Expand Up @@ -75,22 +75,25 @@ describe("[U] extract/parse/to-javascript-ast", () => {
{},
);
strictEqual(likelyTheArrowExpression.type, "ArrowFunctionExpression");
expect(
strictEqual(
get(
likelyTheArrowExpression,
"body.callee.type",
"not a member expression",
),
).to.equal("MemberExpression");
expect(
"MemberExpression",
);
strictEqual(
get(likelyTheArrowExpression, "body.callee.object.name", "not react"),
).to.equal("React");
expect(
"React",
);
strictEqual(
get(
likelyTheArrowExpression,
"body.callee.property.name",
"not createElement",
),
).to.equal("createElement");
"createElement",
);
});
});

0 comments on commit 80fe5a6

Please sign in to comment.