* 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
14 lines
450 B
JavaScript
14 lines
450 B
JavaScript
const {reject} = require('./_30s.js');
|
|
|
|
test('reject is a Function', () => {
|
|
expect(reject).toBeInstanceOf(Function);
|
|
});
|
|
const noEvens = reject(x => x % 2 === 0, [1, 2, 3, 4, 5]);
|
|
test('Works with numbers', () => {
|
|
expect(noEvens).toEqual([1, 3, 5]);
|
|
});
|
|
const fourLettersOrLess = reject(word => word.length > 4, ['Apple', 'Pear', 'Kiwi', 'Banana']);
|
|
test('Works with strings', () => {
|
|
expect(fourLettersOrLess).toEqual(['Pear', 'Kiwi']);
|
|
});
|