mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
36 lines
681 B
JavaScript
36 lines
681 B
JavaScript
import annotateAsPure from "../lib/index.js";
|
|
|
|
describe("@babel/helper-annotate-as-pure", () => {
|
|
it("will add leading comment", () => {
|
|
const node = {};
|
|
annotateAsPure(node);
|
|
|
|
expect(node.leadingComments).toEqual([
|
|
{
|
|
type: "CommentBlock",
|
|
value: "#__PURE__",
|
|
},
|
|
]);
|
|
});
|
|
|
|
it("will not add an extra leading comment", () => {
|
|
const node = {
|
|
leadingComments: [
|
|
{
|
|
type: "CommentBlock",
|
|
value: "#__PURE__",
|
|
},
|
|
],
|
|
};
|
|
|
|
annotateAsPure(node);
|
|
|
|
expect(node.leadingComments).toEqual([
|
|
{
|
|
type: "CommentBlock",
|
|
value: "#__PURE__",
|
|
},
|
|
]);
|
|
});
|
|
});
|