diff --git a/test/isArrayLike/isArrayLike.test.js b/test/isArrayLike/isArrayLike.test.js index 2239caf3d..97b41b827 100644 --- a/test/isArrayLike/isArrayLike.test.js +++ b/test/isArrayLike/isArrayLike.test.js @@ -5,9 +5,12 @@ test('Testing isArrayLike', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof isArrayLike === 'function', 'isArrayLike is a Function'); + t.equal(isArrayLike('abc'), true, 'Returns true for a string'); + t.equal(isArrayLike([1,2,3]), true, 'Returns true for an array'); + t.equal(isArrayLike(null), false, 'Returns false for null'); //t.deepEqual(isArrayLike(args..), 'Expected'); //t.equal(isArrayLike(args..), 'Expected'); //t.false(isArrayLike(args..), 'Expected'); //t.throws(isArrayLike(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/isEmpty/isEmpty.test.js b/test/isEmpty/isEmpty.test.js index 2c101b5c5..76fc0aef8 100644 --- a/test/isEmpty/isEmpty.test.js +++ b/test/isEmpty/isEmpty.test.js @@ -5,9 +5,19 @@ test('Testing isEmpty', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof isEmpty === 'function', 'isEmpty is a Function'); + t.equal(isEmpty(new Map()), true, 'Returns true for empty Map'); + t.equal(isEmpty(new Set()), true, 'Returns true for empty Set'); + t.equal(isEmpty([]), true, 'Returns true for empty array'); + t.equal(isEmpty({}), true, 'Returns true for empty object'); + t.equal(isEmpty(''), true, 'Returns true for empty string'); + t.equal(isEmpty([1, 2]), false, 'Returns false for non-empty array'); + t.equal(isEmpty({ a: 1, b: 2 }), false, 'Returns false for non-empty object'); + t.equal(isEmpty('text'), false, 'Returns false for non-empty string'); + t.equal(isEmpty(123), true, 'Returns true - type is not considered a collection'); + t.equal(isEmpty(true), true, 'Returns true - type is not considered a collection'); //t.deepEqual(isEmpty(args..), 'Expected'); //t.equal(isEmpty(args..), 'Expected'); //t.false(isEmpty(args..), 'Expected'); //t.throws(isEmpty(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/isNil/isNil.test.js b/test/isNil/isNil.test.js index 4ad388e23..c5e11d1f4 100644 --- a/test/isNil/isNil.test.js +++ b/test/isNil/isNil.test.js @@ -5,9 +5,12 @@ test('Testing isNil', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof isNil === 'function', 'isNil is a Function'); + t.equal(isNil(null), true, 'Returns true for null'); + t.equal(isNil(undefined), true, 'Returns true for undefined'); + t.equal(isNil(''), false, 'Returns false for an empty string'); //t.deepEqual(isNil(args..), 'Expected'); //t.equal(isNil(args..), 'Expected'); //t.false(isNil(args..), 'Expected'); //t.throws(isNil(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/isObjectLike/isObjectLike.test.js b/test/isObjectLike/isObjectLike.test.js index aa9f7b7e8..fe414423b 100644 --- a/test/isObjectLike/isObjectLike.test.js +++ b/test/isObjectLike/isObjectLike.test.js @@ -5,9 +5,13 @@ test('Testing isObjectLike', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof isObjectLike === 'function', 'isObjectLike is a Function'); + t.equal(isObjectLike({}), true, 'Returns true for an object'); + t.equal(isObjectLike([1, 2, 3]), true, 'Returns true for an array'); + t.equal(isObjectLike(x => x), false, 'Returns false for a function'); + t.equal(isObjectLike(null), false, 'Returns false for null'); //t.deepEqual(isObjectLike(args..), 'Expected'); //t.equal(isObjectLike(args..), 'Expected'); //t.false(isObjectLike(args..), 'Expected'); //t.throws(isObjectLike(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/isPlainObject/isPlainObject.test.js b/test/isPlainObject/isPlainObject.test.js index 9de8feba3..515b61b2d 100644 --- a/test/isPlainObject/isPlainObject.test.js +++ b/test/isPlainObject/isPlainObject.test.js @@ -5,9 +5,11 @@ test('Testing isPlainObject', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof isPlainObject === 'function', 'isPlainObject is a Function'); + t.equal(isPlainObject({ a: 1 }), true, 'Returns true for a plain object'); + t.equal(isPlainObject(new Map()), false, 'Returns false for a Map (example of non-plain object)'); //t.deepEqual(isPlainObject(args..), 'Expected'); //t.equal(isPlainObject(args..), 'Expected'); //t.false(isPlainObject(args..), 'Expected'); //t.throws(isPlainObject(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/isPromiseLike/isPromiseLike.test.js b/test/isPromiseLike/isPromiseLike.test.js index b84a7c798..5ce5d856b 100644 --- a/test/isPromiseLike/isPromiseLike.test.js +++ b/test/isPromiseLike/isPromiseLike.test.js @@ -5,9 +5,16 @@ test('Testing isPromiseLike', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof isPromiseLike === 'function', 'isPromiseLike is a Function'); + t.equal(isPromiseLike({ + then: function() { + return ''; + } + }), true, 'Returns true for a promise-like object'); + t.equal(isPromiseLike(null), false, 'Returns false for null'); + t.equal(isPromiseLike({}), false, 'Returns false for an empty object'); //t.deepEqual(isPromiseLike(args..), 'Expected'); //t.equal(isPromiseLike(args..), 'Expected'); //t.false(isPromiseLike(args..), 'Expected'); //t.throws(isPromiseLike(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/isUndefined/isUndefined.test.js b/test/isUndefined/isUndefined.test.js index ce988c9ef..43029fcf8 100644 --- a/test/isUndefined/isUndefined.test.js +++ b/test/isUndefined/isUndefined.test.js @@ -5,9 +5,10 @@ test('Testing isUndefined', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof isUndefined === 'function', 'isUndefined is a Function'); + t.true(isUndefined(undefined), 'Returns true for undefined'); //t.deepEqual(isUndefined(args..), 'Expected'); //t.equal(isUndefined(args..), 'Expected'); //t.false(isUndefined(args..), 'Expected'); //t.throws(isUndefined(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/testlog b/test/testlog index c9b797f1e..0e9053f4f 100644 --- a/test/testlog +++ b/test/testlog @@ -1,4 +1,4 @@ -Test log for: Sat Feb 03 2018 13:01:36 GMT+0200 (GTB Standard Time) +Test log for: Sat Feb 03 2018 13:12:08 GMT+0200 (GTB Standard Time) > 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code > tape test/**/*.test.js | tap-spec @@ -670,6 +670,9 @@ Test log for: Sat Feb 03 2018 13:01:36 GMT+0200 (GTB Standard Time) Testing isArrayLike √ isArrayLike is a Function + √ Returns true for a string + √ Returns true for an array + √ Returns false for null Testing isBoolean @@ -685,6 +688,16 @@ Test log for: Sat Feb 03 2018 13:01:36 GMT+0200 (GTB Standard Time) Testing isEmpty √ isEmpty is a Function + √ Returns true for empty Map + √ Returns true for empty Set + √ Returns true for empty array + √ Returns true for empty object + √ Returns true for empty string + √ Returns false for non-empty array + √ Returns false for non-empty object + √ Returns false for non-empty string + √ Returns true - type is not considered a collection + √ Returns true - type is not considered a collection Testing isEven @@ -712,6 +725,9 @@ Test log for: Sat Feb 03 2018 13:01:36 GMT+0200 (GTB Standard Time) Testing isNil √ isNil is a Function + √ Returns true for null + √ Returns true for undefined + √ Returns false for an empty string Testing isNull @@ -736,10 +752,16 @@ Test log for: Sat Feb 03 2018 13:01:36 GMT+0200 (GTB Standard Time) Testing isObjectLike √ isObjectLike is a Function + √ Returns true for an object + √ Returns true for an array + √ Returns false for a function + √ Returns false for null Testing isPlainObject √ isPlainObject is a Function + √ Returns true for a plain object + √ Returns false for a Map (example of non-plain object) Testing isPrime @@ -764,6 +786,9 @@ Test log for: Sat Feb 03 2018 13:01:36 GMT+0200 (GTB Standard Time) Testing isPromiseLike √ isPromiseLike is a Function + √ Returns true for a promise-like object + √ Returns false for null + √ Returns false for an empty object Testing isRegExp @@ -805,6 +830,7 @@ Test log for: Sat Feb 03 2018 13:01:36 GMT+0200 (GTB Standard Time) Testing isUndefined √ isUndefined is a Function + √ Returns true for undefined Testing isUpperCase @@ -1662,8 +1688,8 @@ Test log for: Sat Feb 03 2018 13:01:36 GMT+0200 (GTB Standard Time) √ Works with multiple promises - total: 766 - passing: 766 + total: 792 + passing: 792 duration: 2.4s