Test cleanup and fixes [a-b]

This commit is contained in:
Angelos Chalaris
2018-06-18 15:54:48 +03:00
parent a78f5db260
commit 026c65a5e6
151 changed files with 753 additions and 373 deletions

View File

@ -6,9 +6,15 @@ const nthArg = require('./nthArg.js');
expect(nthArg).toBeInstanceOf(Function);
});
const third = nthArg(2);
t.equal(third(1, 2, 3), 3, 'Returns the nth argument');
t.equal(third(1, 2), undefined, 'Returns undefined if arguments too few');
test('Returns the nth argument', () => {
expect(third(1, 2, 3), 3).toBe()
});
test('Returns undefined if arguments too few', () => {
expect(third(1, 2), undefined).toBe()
});
const last = nthArg(-1);
t.equal(last(1, 2, 3, 4, 5), 5, 'Works for negative values');
test('Works for negative values', () => {
expect(last(1, 2, 3, 4, 5), 5).toBe()
});