* Migrate the following packages' tests:
* babel-helper-annotate-as-pure
* babel-helper-module-imports
* babel-helper-transform-fixture-test-runner
* babel-highlight
* babel-node
* babel-plugin-transform-modules-commonjs
* babel-preset-env-standalone
* babel-preset-env
* babel-preset-es2015
* babel-preset-react
* babel-standalone
* babel-template
* babel-traverse
* babel-types
36 lines
669 B
JavaScript
36 lines
669 B
JavaScript
import annotateAsPure from "../";
|
|
|
|
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__",
|
|
},
|
|
]);
|
|
});
|
|
});
|