forked from babel/babel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak and add tests to babel-helper-annotate-as-pure (babel#7245)
- Loading branch information
1 parent
1ee0cf6
commit dce31b4
Showing
2 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import annotateAsPure from "../"; | ||
import assert from "assert"; | ||
|
||
describe("@babel/helper-annotate-as-pure", () => { | ||
it("will add leading comment", () => { | ||
const node = {}; | ||
annotateAsPure(node); | ||
|
||
assert.deepEqual(node.leadingComments, [ | ||
{ | ||
type: "CommentBlock", | ||
value: "#__PURE__", | ||
}, | ||
]); | ||
}); | ||
|
||
it("will not add an extra leading comment", () => { | ||
const node = { | ||
leadingComments: [ | ||
{ | ||
type: "CommentBlock", | ||
value: "#__PURE__", | ||
}, | ||
], | ||
}; | ||
|
||
annotateAsPure(node); | ||
|
||
assert.deepEqual(node.leadingComments, [ | ||
{ | ||
type: "CommentBlock", | ||
value: "#__PURE__", | ||
}, | ||
]); | ||
}); | ||
}); |