source: imaps-frontend/node_modules/object.fromentries/test/tests.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 584 bytes
Line 
1'use strict';
2
3module.exports = function (fromEntries, t) {
4 var a = {};
5 var b = {};
6 var c = {};
7 var entries = [['a', a], ['b', b], ['c', c]];
8 var obj = { a: a, b: b, c: c };
9
10 t.deepEqual(fromEntries(entries), obj, 'entries -> obj');
11
12 t['throws'](function () { fromEntries(); }, 'entries throws on absent iterable');
13 t['throws'](function () { fromEntries(undefined); }, 'entries throws on undefined');
14 t['throws'](function () { fromEntries(null); }, 'entries throws on null');
15
16 t.deepEqual(fromEntries([['foo', 1], ['foo', 2]]), { foo: 2 }, 'works with a duplicate key');
17};
Note: See TracBrowser for help on using the repository browser.