source: imaps-frontend/node_modules/is-weakref/test/index.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: 696 bytes
RevLine 
[d565449]1'use strict';
2
3var test = require('tape');
4var inspect = require('object-inspect');
5var forEach = require('for-each');
6
7var isWeakRef = require('..');
8
9test('isWeakRef', function (t) {
10 t.equal(typeof isWeakRef, 'function', 'is a function');
11
12 var nonWeakRefs = [undefined, null, true, false, 42, 0, Infinity, NaN, /a/g, function () {}, {}, []];
13 forEach(nonWeakRefs, function (nonWeakRef) {
14 t.equal(isWeakRef(nonWeakRef), false, inspect(nonWeakRef) + ' is not a WeakRef');
15 });
16
17 t.test('actual WeakRefs', { skip: typeof WeakRef === 'undefined' }, function (st) {
18 var ref = new WeakRef({});
19
20 st.equal(isWeakRef(ref), true, inspect(ref) + ' is a WeakRef');
21
22 st.end();
23 });
24
25 t.end();
26});
Note: See TracBrowser for help on using the repository browser.