Skip to content

Commit

Permalink
Adding a few more Map#size tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 7, 2015
1 parent cccdb97 commit fd508b7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,18 @@ describe('Collections', function () {
expect(Map.prototype).to.not.equal(Object.prototype);
});

it('Map.prototype.size should throw TypeError', function () {
// see https://github.com/paulmillr/es6-shim/issues/176
expect(function () { return Map.prototype.size; }).to['throw'](TypeError);
expect(function () { return Map.prototype.size; }).to['throw'](TypeError);
describe('#size', function () {
it('throws TypeError when accessed directly', function () {
// see https://github.com/paulmillr/es6-shim/issues/176
expect(function () { return Map.prototype.size; }).to['throw'](TypeError);
expect(function () { return Map.prototype.size; }).to['throw'](TypeError);
});

it('is an accessor function on the prototype', function () {
expect(Map.prototype).ownPropertyDescriptor('size').to.have.property('get');
expect(typeof Object.getOwnPropertyDescriptor(Map.prototype, 'size').get).to.equal('function');
expect(new Map()).not.to.haveOwnPropertyDescriptor('size');
});
});

it('should return false when deleting a nonexistent key', function () {
Expand Down

0 comments on commit fd508b7

Please sign in to comment.