Skip to content

Commit

Permalink
Use instanceOf chai matcher.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 9, 2014
1 parent a9c0b0d commit 59be3cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test-sham/set-prototype-of.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ describe('Object.setPrototypeOf(o, p)', function () {

it('changes prototype to regular objects', function () {
var obj = {a: 123};
expect(obj instanceof Object).to.equal(true);
expect(obj).to.be.an.instanceOf(Object);
// sham requires assignment to work cross browser
obj = Object.setPrototypeOf(obj, null);
expect(obj instanceof Object).to.equal(false);
expect(obj).not.to.be.an.instanceOf(Object);
expect(obj.a).to.equal(123);
});

it('changes prototype to null objects', function () {
var obj = Object.create(null);
obj.a = 456;
expect(obj instanceof Object).to.equal(false);
expect(obj).not.to.be.an.instanceOf(Object);
expect(obj.a).to.equal(456);
// sham requires assignment to work cross browser
obj = Object.setPrototypeOf(obj, {});
expect(obj instanceof Object).to.equal(true);
expect(obj).to.be.an.instanceOf(Object);
expect(obj.a).to.equal(456);
});

Expand Down

0 comments on commit 59be3cb

Please sign in to comment.