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;
|
||||
}
|
||||
}
|
||||
assert(test());
|
||||
expect(test()).toBe(true);
|
||||
|
||||
const test2 = () => {
|
||||
try {
|
||||
@ -16,4 +16,4 @@ const test2 = () => {
|
||||
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;};
|
||||
}
|
||||
|
||||
assert(data.every(item => item));
|
||||
expect(data.every(item => item)).toBe(true);
|
||||
|
||||
@ -13,12 +13,12 @@ var res = transform(code, {
|
||||
Scope: {
|
||||
exit: function(path) {
|
||||
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;
|
||||
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;
|
||||
switch (x) {
|
||||
case 1: {
|
||||
assert(x, 1);
|
||||
expect(x).toBe(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user