Test cleanup and fixes [i-l]

This commit is contained in:
Angelos Chalaris
2018-06-18 17:31:56 +03:00
parent f67e121ed8
commit 82f0d6bc52
59 changed files with 358 additions and 452 deletions

View File

@ -1,39 +1,36 @@
const expect = require('expect');
const isEmpty = require('./isEmpty.js');
test('isEmpty is a Function', () => {
test('isEmpty is a Function', () => {
expect(isEmpty).toBeInstanceOf(Function);
});
test('Returns true for empty Map', () => {
expect(isEmpty(new Map()), true).toBe()
test('Returns true for empty Map', () => {
expect(isEmpty(new Map())).toBeTruthy();
});
test('Returns true for empty Set', () => {
expect(isEmpty(new Set()), true).toBe()
test('Returns true for empty Set', () => {
expect(isEmpty(new Set())).toBeTruthy();
});
test('Returns true for empty array', () => {
expect(isEmpty([]), true).toBe()
test('Returns true for empty array', () => {
expect(isEmpty([])).toBeTruthy();
});
test('Returns true for empty object', () => {
expect(isEmpty({}), true).toBe()
test('Returns true for empty object', () => {
expect(isEmpty({})).toBeTruthy();
});
test('Returns true for empty string', () => {
expect(isEmpty(''), true).toBe()
test('Returns true for empty string', () => {
expect(isEmpty('')).toBeTruthy();
});
test('Returns false for non-empty array', () => {
expect(isEmpty([1, 2]), false).toBe()
test('Returns false for non-empty array', () => {
expect(isEmpty([1, 2])).toBeFalsy();
});
test('Returns false for non-empty object', () => {
expect(isEmpty({ a: 1, b: 2 }), false).toBe()
test('Returns false for non-empty object', () => {
expect(isEmpty({ a: 1, b: 2 })).toBeFalsy();
});
test('Returns false for non-empty string', () => {
expect(isEmpty('text'), false).toBe()
test('Returns false for non-empty string', () => {
expect(isEmpty('text')).toBeFalsy();
});
test('Returns true - type is not considered a collection', () => {
expect(isEmpty(123), true).toBe()
test('Returns true - type is not considered a collection', () => {
expect(isEmpty(123)).toBeTruthy();
});
test('Returns true - type is not considered a collection', () => {
expect(isEmpty(true), true).toBe()
test('Returns true - type is not considered a collection', () => {
expect(isEmpty(true)).toBeTruthy();
});