tests.js 584 B

1234567891011121314151617
  1. 'use strict';
  2. module.exports = function (fromEntries, t) {
  3. var a = {};
  4. var b = {};
  5. var c = {};
  6. var entries = [['a', a], ['b', b], ['c', c]];
  7. var obj = { a: a, b: b, c: c };
  8. t.deepEqual(fromEntries(entries), obj, 'entries -> obj');
  9. t['throws'](function () { fromEntries(); }, 'entries throws on absent iterable');
  10. t['throws'](function () { fromEntries(undefined); }, 'entries throws on undefined');
  11. t['throws'](function () { fromEntries(null); }, 'entries throws on null');
  12. t.deepEqual(fromEntries([['foo', 1], ['foo', 2]]), { foo: 2 }, 'works with a duplicate key');
  13. };