Files
30-seconds-of-code/test/matchesWith/matchesWith.test.js
Angelos Chalaris 4f1e8b48b6 Test files linted
2018-08-03 10:39:26 +03:00

17 lines
489 B
JavaScript

const expect = require('expect');
const matchesWith = require('./matchesWith.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();
});