Use expect's instanceOf and toHaveProperty methods

This commit is contained in:
Deven Bansod
2018-03-27 21:59:38 +05:30
parent c9b99af5a6
commit b09c729675
51 changed files with 101 additions and 124 deletions

View File

@@ -4,7 +4,7 @@ foo[Symbol.hasInstance]= function () { return true; };
var bar = {};
expect(bar instanceof foo).toBe(true);
expect(new String instanceof String).toBe(true);
expect(new String).toBeInstanceOf(String);
//
@@ -21,5 +21,5 @@ Object.defineProperty(Greeting, Symbol.hasInstance, {
var a = new Greeting("hello");
var b = new Greeting("world");
expect(a instanceof Greeting).toBe(true);
expect(b instanceof Greeting).toBe(false);
expect(a).toBeInstanceOf(Greeting);
expect(b instanceof Greeting).not.toBe(true);