Tests for matches, matchesWith, mapValues
This commit is contained in:
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
10
test/testlog
10
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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user