index.js 558 B

12345678910111213141516
  1. 'use strict';
  2. var test = require('tape');
  3. var has = require('../');
  4. test('has', function (t) {
  5. t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"');
  6. t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"');
  7. t['throws'](function () {
  8. has(null, 'throws');
  9. }, TypeError, 'calling has on null throws TypeError');
  10. t['throws'](function () {
  11. has(void 0, 'throws');
  12. }, TypeError, 'calling has on undefined throws TypeError');
  13. t.end();
  14. });