Files
30-seconds-of-code/test/matchesWith/matchesWith.test.js
Angelos Chalaris a78f5db260 Test migration to jest by hand
Apparently using regular expressions is way easier.
2018-06-18 15:15:56 +03:00

16 lines
452 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);
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');