Migrate -optional-catch-binding, -block-scoping to use jest expect assertions

This commit is contained in:
Deven Bansod 2018-04-12 19:48:53 +05:30
parent 61ec5ce957
commit 80428dec47
5 changed files with 7 additions and 7 deletions

View File

@ -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);

View File

@ -7,4 +7,4 @@ function test () {
}();
}
assert(test(), "inner");
expect(test()).toBe("inner");

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -2,7 +2,7 @@ if (true) {
const x = 1;
switch (x) {
case 1: {
assert(x, 1);
expect(x).toBe(1);
break;
}
}