Test cleanup and fixes [i-l]
This commit is contained in:
@ -1,30 +1,33 @@
|
||||
const expect = require('expect');
|
||||
const last = require('./last.js');
|
||||
|
||||
|
||||
test('last is a Function', () => {
|
||||
test('last is a Function', () => {
|
||||
expect(last).toBeInstanceOf(Function);
|
||||
});
|
||||
test('last({ a: 1234}) returns undefined', () => {
|
||||
test('last({ a: 1234}) returns undefined', () => {
|
||||
expect(last({ a: 1234}) === undefined).toBeTruthy();
|
||||
});
|
||||
test('last([1, 2, 3]) returns 3', () => {
|
||||
expect(last([1, 2, 3])).toBe(3)
|
||||
test('last([1, 2, 3]) returns 3', () => {
|
||||
expect(last([1, 2, 3])).toBe(3);
|
||||
});
|
||||
test('last({ 0: false}) returns undefined', () => {
|
||||
expect(last({ 0: false}), undefined).toBe()
|
||||
test('last({ 0: false}) returns undefined', () => {
|
||||
expect(last({ 0: false})).toBe(undefined);
|
||||
});
|
||||
test('last(String) returns g', () => {
|
||||
expect(last('String'), 'g').toBe()
|
||||
test('last(String) returns g', () => {
|
||||
expect(last('String')).toBe('g');
|
||||
});
|
||||
t.throws(() => last(null), 'last(null) throws an Error');
|
||||
t.throws(() => last(undefined), 'last(undefined) throws an Error');
|
||||
t.throws(() => last(), 'last() throws an Error');
|
||||
|
||||
let start = new Date().getTime();
|
||||
last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]);
|
||||
let end = new Date().getTime();
|
||||
test('last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run', () => {
|
||||
test('last(null) throws an Error', () => {
|
||||
expect(last(null)).toThrow();
|
||||
});
|
||||
test('last(undefined) throws an Error', () => {
|
||||
expect(last(undefined)).toThrow();
|
||||
});
|
||||
test('last() throws an Error', () => {
|
||||
expect(last()).toThrow();
|
||||
});
|
||||
let start = new Date().getTime();
|
||||
last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]);
|
||||
let end = new Date().getTime();
|
||||
test('last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run', () => {
|
||||
expect((end - start) < 2000).toBeTruthy();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user