index.mjs 785 B

123456789101112131415161718192021222324
  1. import index, * as Module from 'object.hasown';
  2. import test from 'tape';
  3. import runTests from './tests.js';
  4. test('as a function', (t) => {
  5. runTests(index, t);
  6. t.end();
  7. });
  8. test('named exports', async (t) => {
  9. t.deepEqual(
  10. Object.keys(Module).sort(),
  11. ['default', 'shim', 'getPolyfill', 'implementation'].sort(),
  12. 'has expected named exports',
  13. );
  14. const { shim, getPolyfill, implementation } = Module;
  15. t.equal((await import('object.hasown/shim')).default, shim, 'shim named export matches deep export');
  16. t.equal((await import('object.hasown/implementation')).default, implementation, 'implementation named export matches deep export');
  17. t.equal((await import('object.hasown/polyfill')).default, getPolyfill, 'getPolyfill named export matches deep export');
  18. t.end();
  19. });