twitst4tz

twitter statistics web application
Log | Files | Refs | README | LICENSE

test.js (2101B)


      1 var assert = require('tap');
      2 
      3 var t = require('./lib/util');
      4 
      5 assert.equal(t.isArray([]), true);
      6 assert.equal(t.isArray({}), false);
      7 
      8 assert.equal(t.isBoolean(null), false);
      9 assert.equal(t.isBoolean(true), true);
     10 assert.equal(t.isBoolean(false), true);
     11 
     12 assert.equal(t.isNull(null), true);
     13 assert.equal(t.isNull(undefined), false);
     14 assert.equal(t.isNull(false), false);
     15 assert.equal(t.isNull(), false);
     16 
     17 assert.equal(t.isNullOrUndefined(null), true);
     18 assert.equal(t.isNullOrUndefined(undefined), true);
     19 assert.equal(t.isNullOrUndefined(false), false);
     20 assert.equal(t.isNullOrUndefined(), true);
     21 
     22 assert.equal(t.isNumber(null), false);
     23 assert.equal(t.isNumber('1'), false);
     24 assert.equal(t.isNumber(1), true);
     25 
     26 assert.equal(t.isString(null), false);
     27 assert.equal(t.isString('1'), true);
     28 assert.equal(t.isString(1), false);
     29 
     30 assert.equal(t.isSymbol(null), false);
     31 assert.equal(t.isSymbol('1'), false);
     32 assert.equal(t.isSymbol(1), false);
     33 assert.equal(t.isSymbol(Symbol()), true);
     34 
     35 assert.equal(t.isUndefined(null), false);
     36 assert.equal(t.isUndefined(undefined), true);
     37 assert.equal(t.isUndefined(false), false);
     38 assert.equal(t.isUndefined(), true);
     39 
     40 assert.equal(t.isRegExp(null), false);
     41 assert.equal(t.isRegExp('1'), false);
     42 assert.equal(t.isRegExp(new RegExp()), true);
     43 
     44 assert.equal(t.isObject({}), true);
     45 assert.equal(t.isObject([]), true);
     46 assert.equal(t.isObject(new RegExp()), true);
     47 assert.equal(t.isObject(new Date()), true);
     48 
     49 assert.equal(t.isDate(null), false);
     50 assert.equal(t.isDate('1'), false);
     51 assert.equal(t.isDate(new Date()), true);
     52 
     53 assert.equal(t.isError(null), false);
     54 assert.equal(t.isError({ err: true }), false);
     55 assert.equal(t.isError(new Error()), true);
     56 
     57 assert.equal(t.isFunction(null), false);
     58 assert.equal(t.isFunction({ }), false);
     59 assert.equal(t.isFunction(function() {}), true);
     60 
     61 assert.equal(t.isPrimitive(null), true);
     62 assert.equal(t.isPrimitive(''), true);
     63 assert.equal(t.isPrimitive(0), true);
     64 assert.equal(t.isPrimitive(new Date()), false);
     65 
     66 assert.equal(t.isBuffer(null), false);
     67 assert.equal(t.isBuffer({}), false);
     68 assert.equal(t.isBuffer(new Buffer(0)), true);