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

@ -5,16 +5,38 @@ const isSorted = require('./isSorted.js');
test('isSorted is a Function', () => {
expect(isSorted).toBeInstanceOf(Function);
});
t.equal(isSorted([0, 1, 2]), 1, 'Array is sorted in ascending order');
t.equal(isSorted([0, 1, 2, 2]), 1, 'Array is sorted in ascending order');
t.equal(isSorted([-4, -3, -2]), 1, 'Array is sorted in ascending order');
t.equal(isSorted([0, 0, 1, 2]), 1, 'Array is sorted in ascending order');
t.equal(isSorted([2, 1, 0]), -1, 'Array is sorted in descending order');
t.equal(isSorted([2, 2, 1, 0]), -1, 'Array is sorted in descending order');
t.equal(isSorted([-2, -3, -4]), -1, 'Array is sorted in descending order');
t.equal(isSorted([2, 1, 0, 0]), -1, 'Array is sorted in descending order');
t.equal(isSorted([]), undefined, 'Array is empty');
t.equal(isSorted([1]), 0, 'Array is not sorted, direction changed in array');
t.equal(isSorted([1, 2, 1]), 0, 'Array is not sorted, direction changed in array');
test('Array is sorted in ascending order', () => {
expect(isSorted([0, 1, 2]), 1).toBe()
});
test('Array is sorted in ascending order', () => {
expect(isSorted([0, 1, 2, 2]), 1).toBe()
});
test('Array is sorted in ascending order', () => {
expect(isSorted([-4, -3, -2]), 1).toBe()
});
test('Array is sorted in ascending order', () => {
expect(isSorted([0, 0, 1, 2]), 1).toBe()
});
test('Array is sorted in descending order', () => {
expect(isSorted([2, 1, 0]), -1).toBe()
});
test('Array is sorted in descending order', () => {
expect(isSorted([2, 2, 1, 0]), -1).toBe()
});
test('Array is sorted in descending order', () => {
expect(isSorted([-2, -3, -4]), -1).toBe()
});
test('Array is sorted in descending order', () => {
expect(isSorted([2, 1, 0, 0]), -1).toBe()
});
test('Array is empty', () => {
expect(isSorted([]), undefined).toBe()
});
test('Array is not sorted, direction changed in array', () => {
expect(isSorted([1]), 0).toBe()
});
test('Array is not sorted, direction changed in array', () => {
expect(isSorted([1, 2, 1]), 0).toBe()
});