Test cleanup and fixes [m-n]

This commit is contained in:
Angelos Chalaris
2018-06-18 17:40:29 +03:00
parent 71d768320b
commit 9f95330528
20 changed files with 102 additions and 153 deletions

View File

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