Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Oct 2, 2022
1 parent fb414d7 commit 3550688
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions packages/babel-core/test/api.js
Expand Up @@ -625,7 +625,6 @@ describe("api", function () {
' throw new TypeError("Cannot call a class as a function");',
" }",
"}",
"",
"let Foo = function Foo() {",
" _classCallCheck(this, Foo);",
"};",
Expand All @@ -636,7 +635,7 @@ describe("api", function () {

expect(
originalPositionFor(consumer, {
line: 7,
line: 6,
column: 4,
}),
).toEqual({
Expand Down Expand Up @@ -710,7 +709,7 @@ describe("api", function () {
],
}).then(function (result) {
expect(result.code).toBe(
"/*before*/\nstart;\n\n/*after*/\nclass Foo {}\n\n/*before*/\nend;\n\n/*after*/",
"/*before*/\nstart;\n/*after*/\nclass Foo {}\n/*before*/\nend;\n/*after*/",
);
});
});
Expand Down
Expand Up @@ -4,7 +4,6 @@ if (x) {
}`;

var expected = `var foo = 1;
if (x) {
var bar = 1;
}`;
Expand Down
10 changes: 5 additions & 5 deletions packages/babel-traverse/test/modification.js
Expand Up @@ -155,7 +155,7 @@ describe("modification", function () {
expect(result).toHaveLength(1);
expect(result[result.length - 1].node).toEqual(t.identifier("b"));
expect(generateCode(rootPath)).toBe(
"if (x) {\n b\n\n for (var i = 0; i < 0; i++) {}\n}",
"if (x) {\n b\n for (var i = 0; i < 0; i++) {}\n}",
);
});

Expand All @@ -168,7 +168,7 @@ describe("modification", function () {
expect(result).toHaveLength(1);
expect(result[result.length - 1].node).toEqual(t.identifier("b"));
expect(generateCode(rootPath)).toBe(
"if (x) {\n b\n\n for (var i = 0; i < 0; i++) {}\n}",
"if (x) {\n b\n for (var i = 0; i < 0; i++) {}\n}",
);
});

Expand Down Expand Up @@ -265,7 +265,7 @@ describe("modification", function () {
expect(result).toHaveLength(1);
expect(result[result.length - 1].node).toEqual(t.identifier("b"));
expect(generateCode(rootPath)).toBe(
"if (x) {\n for (var i = 0; i < 0; i++) {}\n\n b\n}",
"if (x) {\n for (var i = 0; i < 0; i++) {}\n b\n}",
);
});

Expand All @@ -278,7 +278,7 @@ describe("modification", function () {
expect(result).toHaveLength(1);
expect(result[result.length - 1].node).toEqual(t.identifier("b"));
expect(generateCode(rootPath)).toBe(
"if (x) {\n for (var i = 0; i < 0; i++) {}\n\n b\n}",
"if (x) {\n for (var i = 0; i < 0; i++) {}\n b\n}",
);
});

Expand Down Expand Up @@ -343,7 +343,7 @@ describe("modification", function () {
path.insertAfter(t.identifier("x"));

expect(generateCode({ parentPath: bodyPath })).toBe(
"var _temp;\n\nexport default (_temp = fn(), x, _temp);",
"var _temp;\nexport default (_temp = fn(), x, _temp);",
);
});
});
Expand Down

0 comments on commit 3550688

Please sign in to comment.