Files
30-seconds-of-code/test6/union/union.test.js
Angelos Chalaris 5afe81452a 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

24 lines
910 B
JavaScript

const expect = require('expect');
const union = require('./union.js');
test('Testing union', () => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
expect(typeof union === 'function').toBeTruthy();
expect(union([1, 2, 3], [4, 3, 2])).toEqual([1, 2, 3, 4]);
expect(union('str', 'asd')).toEqual([ 's', 't', 'r', 'a', 'd' ]);
expect(union([[], {}], [1, 2, 3])).toEqual([[], {}, 1, 2, 3]);
expect(union([], [])).toEqual([]);
expect(() => union()).toThrow();
expect(() => union(true, 'str')).toThrow();
expect(() => union('false', true)).toThrow();
expect(() => union(123, {})).toThrow();
expect(() => union([], {})).toThrow();
expect(() => union(undefined, null)).toThrow();
let start = new Date().getTime();
union([1, 2, 3], [4, 3, 2]);
let end = new Date().getTime();
expect((end - start) < 2000).toBeTruthy();
});