Files
30-seconds-of-code/test4/last/last.test.js
Angelos Chalaris a59af893bf Migrated tests to jest
Used jest-codemods to migrate, will have to pass everything by hand before we can merge.
2018-06-18 14:18:25 +03:00

20 lines
728 B
JavaScript

const expect = require('expect');
const last = require('./last.js');
test('Testing last', () => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
expect(typeof last === 'function').toBeTruthy();
expect(last({ a: 1234}) === undefined).toBeTruthy();
expect(last([1, 2, 3])).toBe(3);
expect(last({ 0: false})).toBe(undefined);
expect(last('String')).toBe('g');
expect(() => last(null)).toThrow();
expect(() => last(undefined)).toThrow();
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();
expect((end - start) < 2000).toBeTruthy();
});