Migrate -transform-block-scoping and -transform-classes to jest expect
This commit is contained in:
@@ -5,19 +5,19 @@ B.b = function() {
|
||||
|
||||
class C extends B {}
|
||||
|
||||
assert.equal(Object.getPrototypeOf(C), B);
|
||||
assert.equal(Object.getPrototypeOf(C.prototype), B.prototype);
|
||||
expect(Object.getPrototypeOf(C)).toBe(B);
|
||||
expect(Object.getPrototypeOf(C.prototype)).toBe(B.prototype);
|
||||
|
||||
assert.equal(C.b(), 'B.b');
|
||||
expect(C.b()).toBe('B.b');
|
||||
|
||||
class D extends Object {}
|
||||
|
||||
assert.ok(D instanceof Object)
|
||||
assert.ok(D.prototype instanceof Object);
|
||||
assert.equal(D.keys, Object.keys);
|
||||
expect(D instanceof Object).toBeTruthy();
|
||||
expect(D.prototype instanceof Object).toBeTruthy();
|
||||
expect(D.keys).toBe(Object.keys);
|
||||
|
||||
class E {}
|
||||
|
||||
assert.equal(Object.getPrototypeOf(E), Function.prototype);
|
||||
assert.equal(Object.getPrototypeOf(E.prototype), Object.prototype);
|
||||
assert.isFalse('keys' in E);
|
||||
expect(Object.getPrototypeOf(E)).toBe(Function.prototype);
|
||||
expect(Object.getPrototypeOf(E.prototype)).toBe(Object.prototype);
|
||||
expect(E).not.toContain('keys');
|
||||
|
||||
@@ -6,4 +6,4 @@ class Foo {
|
||||
|
||||
var Bar = Foo;
|
||||
Foo = 5;
|
||||
assert.equal((new Bar).bar(), Bar);
|
||||
expect((new Bar).bar()).toBe(Bar);
|
||||
|
||||
@@ -6,4 +6,4 @@ var Foo = class Foo {
|
||||
|
||||
var Bar = Foo;
|
||||
Foo = 5;
|
||||
assert.equal((new Bar).bar(), Bar);
|
||||
expect((new Bar).bar()).toBe(Bar);
|
||||
|
||||
@@ -6,6 +6,6 @@ class Foo {
|
||||
|
||||
var Bar = Foo;
|
||||
Foo = 5;
|
||||
assert.throws(function () {
|
||||
expect(function () {
|
||||
Bar.call(6);
|
||||
}, /Cannot call a class as a function/);
|
||||
}).toThrow("Cannot call a class as a function");
|
||||
|
||||
@@ -5,5 +5,5 @@ class Foo {
|
||||
}
|
||||
|
||||
const f = new Foo;
|
||||
assert.ok(f instanceof Foo);
|
||||
assert.ok(typeof f === "object");
|
||||
expect(f instanceof Foo).toBeTruthy();
|
||||
expect(typeof f).toBe("object");
|
||||
|
||||
@@ -7,4 +7,4 @@ function build(val) {
|
||||
}
|
||||
|
||||
var Class = build.call({ key: "foo" }, "bar");
|
||||
assert.equal(new Class().foo(), "bar");
|
||||
expect(new Class().foo()).toBe("bar");
|
||||
|
||||
@@ -18,4 +18,4 @@ class Derived extends Base {
|
||||
}
|
||||
|
||||
new Derived().p();
|
||||
assert.equal(log, '[Derived][Base][OtherBase]');
|
||||
expect(log).toBe('[Derived][Base][OtherBase]');
|
||||
|
||||
@@ -6,8 +6,8 @@ class Foo {
|
||||
|
||||
class Bar extends Foo {
|
||||
constructor() {
|
||||
assert.equal(super().i, 1);
|
||||
assert.equal(this.i, 1);
|
||||
expect(super().i).toBe(1);
|
||||
expect(this.i).toBe(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user