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);
assert.equal(obj.test, 2);
assert.equal(obj.get(), 1);
expect(obj.test).toBe(2);
expect(obj.get()).toBe(1);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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