* chore: make aware eslint that we use jest By setting up the jest environment, we no longer need to declare the 'test' global in the configuration. * chore: don't need to import expect, it's a jest environment global * chore: don't need to import expect when creating undefined test
16 lines
450 B
JavaScript
16 lines
450 B
JavaScript
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();
|
|
});
|