diff --git a/test/mapValues/mapValues.test.js b/test/mapValues/mapValues.test.js index 741e4f4f3..273ada753 100644 --- a/test/mapValues/mapValues.test.js +++ b/test/mapValues/mapValues.test.js @@ -5,9 +5,14 @@ test('Testing mapValues', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof mapValues === 'function', 'mapValues is a Function'); + const users = { + fred: { user: 'fred', age: 40 }, + pebbles: { user: 'pebbles', age: 1 } + }; + t.deepEqual(mapValues(users, u => u.age), { fred: 40, pebbles: 1 }, 'Maps values'); //t.deepEqual(mapValues(args..), 'Expected'); //t.equal(mapValues(args..), 'Expected'); //t.false(mapValues(args..), 'Expected'); //t.throws(mapValues(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/matches/matches.test.js b/test/matches/matches.test.js index 82fd66a08..e28065fa5 100644 --- a/test/matches/matches.test.js +++ b/test/matches/matches.test.js @@ -5,9 +5,11 @@ test('Testing matches', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof matches === 'function', 'matches is a Function'); + t.true(matches({ age: 25, hair: 'long', beard: true }, { hair: 'long', beard: true }), 'Matches returns true for two similar objects'); + t.false(matches({ hair: 'long', beard: true }, { age: 25, hair: 'long', beard: true }), 'Matches returns false for two non-similar objects'); //t.deepEqual(matches(args..), 'Expected'); //t.equal(matches(args..), 'Expected'); //t.false(matches(args..), 'Expected'); //t.throws(matches(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/matchesWith/matchesWith.test.js b/test/matchesWith/matchesWith.test.js index b7f696224..9ce717785 100644 --- a/test/matchesWith/matchesWith.test.js +++ b/test/matchesWith/matchesWith.test.js @@ -5,9 +5,15 @@ test('Testing matchesWith', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof matchesWith === 'function', 'matchesWith is a Function'); + const isGreeting = val => /^h(?:i|ello)$/.test(val); + t.true(matchesWith( + { greeting: 'hello' }, + { greeting: 'hi' }, + (oV, sV) => isGreeting(oV) && isGreeting(sV) + ), 'Returns true for two objects with similar values, based on the provided function'); //t.deepEqual(matchesWith(args..), 'Expected'); //t.equal(matchesWith(args..), 'Expected'); //t.false(matchesWith(args..), 'Expected'); //t.throws(matchesWith(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/testlog b/test/testlog index 86b81e2d7..69a133302 100644 --- a/test/testlog +++ b/test/testlog @@ -1,4 +1,4 @@ -Test log for: Sat Feb 03 2018 13:28:38 GMT+0200 (GTB Standard Time) +Test log for: Sat Feb 03 2018 13:32:50 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 @@ -918,6 +918,7 @@ Test log for: Sat Feb 03 2018 13:28:38 GMT+0200 (GTB Standard Time) Testing mapValues √ mapValues is a Function + √ Maps values Testing mask @@ -929,10 +930,13 @@ Test log for: Sat Feb 03 2018 13:28:38 GMT+0200 (GTB Standard Time) Testing matches √ matches is a Function + √ Matches returns true for two similar objects + √ Matches returns false for two non-similar objects Testing matchesWith √ matchesWith is a Function + √ Returns true for two objects with similar values, based on the provided function Testing maxBy @@ -1691,8 +1695,8 @@ Test log for: Sat Feb 03 2018 13:28:38 GMT+0200 (GTB Standard Time) √ Works with multiple promises - total: 795 - passing: 795 + total: 799 + passing: 799 duration: 2.4s