Test cleanup and fixes [w-z]

This commit is contained in:
Angelos Chalaris
2018-06-18 19:01:06 +03:00
parent c0a42d906a
commit 584ed191d4
8 changed files with 118 additions and 106 deletions

View File

@ -1,27 +1,33 @@
const expect = require('expect');
const without = require('./without.js');
test('without is a Function', () => {
test('without is a Function', () => {
expect(without).toBeInstanceOf(Function);
});
test('without([2, 1, 2, 3], 1, 2) returns [3]', () => {
expect(without([2, 1, 2, 3], 1, 2)).toEqual([3])
test('without([2, 1, 2, 3], 1, 2) returns [3]', () => {
expect(without([2, 1, 2, 3], 1, 2)).toEqual([3]);
});
test('without([]) returns []', () => {
expect(without([])).toEqual([])
test('without([]) returns []', () => {
expect(without([])).toEqual([]);
});
test('without([3, 1, true, '3', true], '3', true) returns [3, 1]', () => {
expect(without([3, 1, true, '3', true], '3', true), [3).toEqual(1])
test('without([3, 1, true, '3', true], '3', true) returns [3, 1]', () => {
expect(without([3, 1, true, '3', true], '3', true)).toEqual([3, 1]);
});
test('without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n']', () => {
expect(without('string'.split(''), 's', 't', 'g'), ['r', 'i').toEqual('n'])
test('without('string'.split(''), 's', 't', 'g') returns [\'r\', \'i\', \'n\']', () => {
expect(without('string'.split(''), 's', 't', 'g')).toEqual(['r', 'i', 'n']);
});
test('without() throws an error', () => {
expect(without()).toThrow();
});
test('without(null) throws an error', () => {
expect(without(null)).toThrow();
});
test('without(undefined) throws an error', () => {
expect(without(undefined)).toThrow();
});
test('without(123) throws an error', () => {
expect(without(123)).toThrow();
});
test('without({}) throws an error', () => {
expect(without({})).toThrow();
});
t.throws(() => without(), 'without() throws an error');
t.throws(() => without(null), 'without(null) throws an error');
t.throws(() => without(undefined), 'without(undefined) throws an error');
t.throws(() => without(123), 'without() throws an error');
t.throws(() => without({}), 'without({}) throws an error');