Migrate -optional-catch-binding, -block-scoping to use jest expect assertions
This commit is contained in:
parent
61ec5ce957
commit
80428dec47
@ -6,7 +6,7 @@ const test = () => {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(test());
|
expect(test()).toBe(true);
|
||||||
|
|
||||||
const test2 = () => {
|
const test2 = () => {
|
||||||
try {
|
try {
|
||||||
@ -16,4 +16,4 @@ const test2 = () => {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(test2());
|
expect(test2()).toBe(true);
|
||||||
|
|||||||
@ -7,4 +7,4 @@ function test () {
|
|||||||
}();
|
}();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(test(), "inner");
|
expect(test()).toBe("inner");
|
||||||
|
|||||||
@ -10,4 +10,4 @@ for (let index = 0; index < data.length; index++) {
|
|||||||
let fn = function () {item;};
|
let fn = function () {item;};
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(data.every(item => item));
|
expect(data.every(item => item)).toBe(true);
|
||||||
|
|||||||
@ -13,12 +13,12 @@ var res = transform(code, {
|
|||||||
Scope: {
|
Scope: {
|
||||||
exit: function(path) {
|
exit: function(path) {
|
||||||
if (innerScope) {
|
if (innerScope) {
|
||||||
assert(Object.keys(path.scope.bindings).length === 0, 'Inner scope should not have any bindings');
|
expect(Object.keys(path.scope.bindings)).toHaveLength(0);
|
||||||
innerScope = false;
|
innerScope = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(Object.keys(path.scope.bindings).length === 2, 'Outer scope subsume the inner-scope binding');
|
expect(Object.keys(path.scope.bindings)).toHaveLength(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ if (true) {
|
|||||||
const x = 1;
|
const x = 1;
|
||||||
switch (x) {
|
switch (x) {
|
||||||
case 1: {
|
case 1: {
|
||||||
assert(x, 1);
|
expect(x).toBe(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user