Updated the test system
This commit is contained in:
16
test/matchesWith.test.js
Normal file
16
test/matchesWith.test.js
Normal file
@ -0,0 +1,16 @@
|
||||
const expect = require('expect');
|
||||
const {matchesWith} = require('./_30s.js');
|
||||
|
||||
test('matchesWith is a Function', () => {
|
||||
expect(matchesWith).toBeInstanceOf(Function);
|
||||
});
|
||||
const isGreeting = val => /^h(?:i|ello)$/.test(val);
|
||||
test('Returns true for two objects with similar values, based on the provided function', () => {
|
||||
expect(
|
||||
matchesWith(
|
||||
{ greeting: 'hello' },
|
||||
{ greeting: 'hi' },
|
||||
(oV, sV) => isGreeting(oV) && isGreeting(sV)
|
||||
)
|
||||
).toBeTruthy();
|
||||
});
|
||||
Reference in New Issue
Block a user