Migrate -transform-object-super tests to use jest expect assertions

This commit is contained in:
Deven Bansod 2018-04-12 19:50:11 +05:30
parent 8a31eabf5e
commit d7987fbbd2
48 changed files with 188 additions and 188 deletions

View File

@ -12,5 +12,5 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), 1); expect(obj.get()).toBe(1);

View File

@ -12,5 +12,5 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), 1); expect(obj.get()).toBe(1);

View File

@ -20,5 +20,5 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), 1); expect(obj.get()).toBe(1);

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
const Base = { const Base = {
get test() { get test() {
assert.equal(this, obj); expect(this).toBe(obj);
return 1; return 1;
} }
}; };
@ -15,5 +15,5 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), 1); expect(obj.get()).toBe(1);

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
const Base = { const Base = {
get test() { get test() {
assert.equal(this, obj); expect(this).toBe(obj);
return 1; return 1;
} }
}; };
@ -15,5 +15,5 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), 1); expect(obj.get()).toBe(1);

View File

@ -10,7 +10,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || functio
const Base = { const Base = {
get test() { get test() {
assert.equal(this, obj); expect(this).toBe(obj);
return 1; return 1;
} }
@ -24,5 +24,5 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), 1); expect(obj.get()).toBe(1);

View File

@ -11,5 +11,5 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), undefined); expect(obj.get()).toBeUndefined();

View File

@ -11,5 +11,5 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), undefined); expect(obj.get()).toBeUndefined();

View File

@ -18,5 +18,5 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), undefined); expect(obj.get()).toBeUndefined();

View File

@ -14,5 +14,5 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), undefined); expect(obj.get()).toBeUndefined();

View File

@ -14,5 +14,5 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), undefined); expect(obj.get()).toBeUndefined();

View File

@ -23,5 +23,5 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
assert.equal(obj.get(), undefined); expect(obj.get()).toBeUndefined();

View File

@ -12,6 +12,6 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, 1); expect(Base.test).toBe(1);
assert.equal(obj.test, 3); expect(obj.test).toBe(3);

View File

@ -12,6 +12,6 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, 3); expect(Base.test).toBe(3);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);

View File

@ -24,6 +24,6 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, 3); expect(Base.test).toBe(3);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);

View File

@ -16,6 +16,6 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, 1); expect(Base.test).toBe(1);
assert.equal(obj.test, 3); expect(obj.test).toBe(3);

View File

@ -15,6 +15,6 @@ var obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, 1); expect(Base.test).toBe(1);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);

View File

@ -16,8 +16,8 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
obj.set(); obj.set();
}); }).toThrow();
assert.equal(Base.test, 1); expect(Base.test).toBe(1);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);

View File

@ -16,9 +16,9 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
obj.set(); obj.set();
}); }).toThrow();
assert.equal(called, false); expect(called).toBe(false);
assert.equal(Base.test, 1); expect(Base.test).toBe(1);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);

View File

@ -14,10 +14,10 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
// this requires helpers to be in file (not external), so they // this requires helpers to be in file (not external), so they
// are in "strict" mode code. // are in "strict" mode code.
obj.set(); obj.set();
}); }).toThrow();
assert.equal(Base.test, 1); expect(Base.test).toBe(1);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);

View File

@ -27,10 +27,10 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
// this requires helpers to be in file (not external), so they // this requires helpers to be in file (not external), so they
// are in "strict" mode code. // are in "strict" mode code.
obj.set(); obj.set();
}); }).toThrow();
assert.equal(Base.test, 1); expect(Base.test).toBe(1);
assert.equal(obj.test, 2); expect(obj.test).toBe(2);

View File

@ -15,11 +15,11 @@ Object.defineProperty(obj, 'test', {
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, false); expect(desc.configurable).toBe(false);
assert.equal(desc.writable, true); expect(desc.writable).toBe(true);
assert.equal(desc.enumerable, true); expect(desc.enumerable).toBe(true);

View File

@ -15,11 +15,11 @@ Object.defineProperty(obj, 'test', {
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, false); expect(desc.configurable).toBe(false);
assert.equal(desc.writable, true); expect(desc.writable).toBe(true);
assert.equal(desc.enumerable, true); expect(desc.enumerable).toBe(true);

View File

@ -26,10 +26,10 @@ Object.defineProperty(obj, 'test', {
enumerable: true enumerable: true
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, false); expect(desc.configurable).toBe(false);
assert.equal(desc.writable, true); expect(desc.writable).toBe(true);
assert.equal(desc.enumerable, true); expect(desc.enumerable).toBe(true);

View File

@ -15,11 +15,11 @@ Object.defineProperty(obj, 'test', {
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, true); expect(desc.configurable).toBe(true);
assert.equal(desc.writable, true); expect(desc.writable).toBe(true);
assert.equal(desc.enumerable, false); expect(desc.enumerable).toBe(false);

View File

@ -15,11 +15,11 @@ Object.defineProperty(obj, 'test', {
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, true); expect(desc.configurable).toBe(true);
assert.equal(desc.writable, true); expect(desc.writable).toBe(true);
assert.equal(desc.enumerable, false); expect(desc.enumerable).toBe(false);

View File

@ -26,10 +26,10 @@ Object.defineProperty(obj, 'test', {
enumerable: false enumerable: false
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, true); expect(desc.configurable).toBe(true);
assert.equal(desc.writable, true); expect(desc.writable).toBe(true);
assert.equal(desc.enumerable, false); expect(desc.enumerable).toBe(false);

View File

@ -14,11 +14,11 @@ Object.defineProperty(obj, 'test', {
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, true); expect(desc.configurable).toBe(true);
assert.equal(desc.writable, false); expect(desc.writable).toBe(false);
assert.equal(desc.enumerable, true); expect(desc.enumerable).toBe(true);

View File

@ -15,13 +15,13 @@ Object.defineProperty(obj, 'test', {
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
obj.set(); obj.set();
}); }).toThrow();
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, true); expect(desc.configurable).toBe(true);
assert.equal(desc.writable, false); expect(desc.writable).toBe(false);
assert.equal(desc.enumerable, true); expect(desc.enumerable).toBe(true);

View File

@ -15,13 +15,13 @@ Object.defineProperty(obj, 'test', {
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
obj.set(); obj.set();
}); }).toThrow();
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, true); expect(desc.configurable).toBe(true);
assert.equal(desc.writable, false); expect(desc.writable).toBe(false);
assert.equal(desc.enumerable, true); expect(desc.enumerable).toBe(true);

View File

@ -26,12 +26,12 @@ Object.defineProperty(obj, 'test', {
enumerable: true enumerable: true
}); });
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
obj.set(); obj.set();
}); }).toThrow();
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 2); expect(obj.test).toBe(2);
const desc = Object.getOwnPropertyDescriptor(obj, 'test'); const desc = Object.getOwnPropertyDescriptor(obj, 'test');
assert.equal(desc.configurable, true); expect(desc.configurable).toBe(true);
assert.equal(desc.writable, false); expect(desc.writable).toBe(false);
assert.equal(desc.enumerable, true); expect(desc.enumerable).toBe(true);

View File

@ -11,6 +11,6 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);

View File

@ -11,6 +11,6 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);

View File

@ -22,6 +22,6 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);

View File

@ -13,7 +13,7 @@ var obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(called, false); expect(called).toBe(false);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, undefined); expect(obj.test).toBeUndefined();

View File

@ -14,9 +14,9 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
obj.set(); obj.set();
}); }).toThrow();
assert.equal(called, false); expect(called).toBe(false);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, undefined); expect(obj.test).toBeUndefined();

View File

@ -11,10 +11,10 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
// this requires helpers to be in file (not external), so they // this requires helpers to be in file (not external), so they
// are in "strict" mode code. // are in "strict" mode code.
obj.set(); obj.set();
}); }).toThrow();
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, undefined); expect(obj.test).toBeUndefined();

View File

@ -22,10 +22,10 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
// this requires helpers to be in file (not external), so they // this requires helpers to be in file (not external), so they
// are in "strict" mode code. // are in "strict" mode code.
obj.set(); obj.set();
}); }).toThrow();
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, undefined); expect(obj.test).toBeUndefined();

View File

@ -9,6 +9,6 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);

View File

@ -9,6 +9,6 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);

View File

@ -20,6 +20,6 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 3); expect(obj.test).toBe(3);

View File

@ -13,7 +13,7 @@ var obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(value, 2); expect(value).toBe(2);
assert.equal(obj.test, undefined); expect(obj.test).toBeUndefined();

View File

@ -14,9 +14,9 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.throws(() => { expect(() => {
obj.set(); obj.set();
}); }).toThrow();
assert.equal(value, 2); expect(value).toBe(2);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, undefined); expect(obj.test).toBeUndefined();

View File

@ -5,7 +5,7 @@ const Base = {
let value = 2; let value = 2;
const obj = { const obj = {
set test(v) { set test(v) {
assert.equal(this, obj); expect(this).toBe(obj);
value = v; value = v;
}, },
@ -15,7 +15,7 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(value, 3); expect(value).toBe(3);
assert.equal(obj.test, undefined); expect(obj.test).toBeUndefined();

View File

@ -16,7 +16,7 @@ const Base = {};
let value = 2; let value = 2;
const obj = _obj = { const obj = _obj = {
set test(v) { set test(v) {
assert.equal(this, obj); expect(this).toBe(obj);
value = v; value = v;
}, },
@ -26,7 +26,7 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(value, 3); expect(value).toBe(3);
assert.equal(obj.test, undefined); expect(obj.test).toBeUndefined();

View File

@ -15,7 +15,7 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(value, 3); expect(value).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 2); expect(obj.test).toBe(2);

View File

@ -15,7 +15,7 @@ const obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(value, 3); expect(value).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 2); expect(obj.test).toBe(2);

View File

@ -28,7 +28,7 @@ const obj = _obj = {
}; };
Object.setPrototypeOf(obj, Base); Object.setPrototypeOf(obj, Base);
assert.equal(obj.set(), 3); expect(obj.set()).toBe(3);
assert.equal(value, 3); expect(value).toBe(3);
assert.equal(Base.test, undefined); expect(Base.test).toBeUndefined();
assert.equal(obj.test, 2); expect(obj.test).toBe(2);