source: imaps-frontend/node_modules/es-object-atoms/test/index.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.1 KB
Line 
1'use strict';
2
3var test = require('tape');
4
5var $Object = require('../');
6var isObject = require('../isObject');
7var ToObject = require('../ToObject');
8var RequireObjectCoercible = require('..//RequireObjectCoercible');
9
10test('errors', function (t) {
11 t.equal($Object, Object);
12 // @ts-expect-error
13 t['throws'](function () { ToObject(null); }, TypeError);
14 // @ts-expect-error
15 t['throws'](function () { ToObject(undefined); }, TypeError);
16 // @ts-expect-error
17 t['throws'](function () { RequireObjectCoercible(null); }, TypeError);
18 // @ts-expect-error
19 t['throws'](function () { RequireObjectCoercible(undefined); }, TypeError);
20
21 t.deepEqual(RequireObjectCoercible(true), true);
22 t.deepEqual(ToObject(true), Object(true));
23 t.deepEqual(ToObject(42), Object(42));
24 var f = function () {};
25 t.equal(ToObject(f), f);
26
27 t.equal(isObject(undefined), false);
28 t.equal(isObject(null), false);
29 t.equal(isObject({}), true);
30 t.equal(isObject([]), true);
31 t.equal(isObject(function () {}), true);
32
33 var obj = {};
34 t.equal(RequireObjectCoercible(obj), obj);
35 t.equal(ToObject(obj), obj);
36
37 t.end();
38});
Note: See TracBrowser for help on using the repository browser.