Test cleanup and fixes [q-r]

This commit is contained in:
Angelos Chalaris
2018-06-18 18:13:18 +03:00
parent 072728dad2
commit 9c22d92c34
23 changed files with 147 additions and 202 deletions

View File

@ -1,24 +1,20 @@
const expect = require('expect');
const reject = require('./reject.js');
test('reject is a Function', () => {
test('reject is a Function', () => {
expect(reject).toBeInstanceOf(Function);
});
const noEvens = reject(
(x) => x % 2 === 0,
[1, 2, 3, 4, 5]
);
t.deepEqual(noEvens, [1, 3, 5]);
const fourLettersOrLess = reject(
(word) => word.length > 4,
['Apple', 'Pear', 'Kiwi', 'Banana']
);
t.deepEqual(fourLettersOrLess, ['Pear', 'Kiwi']);
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']);
});