-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathjoin.spec.js
More file actions
53 lines (44 loc) · 1.55 KB
/
Copy pathjoin.spec.js
File metadata and controls
53 lines (44 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require('./join');
describe('join', () => {
const data = ['a', 'e', 'i', 'o', 'u'];
describe('when doesn\'t pass parameters', () => {
test('return \'a,e,i,o,u\'', () => {
expect(data.join()).toBe('a,e,i,o,u');
});
});
describe('when pass \'undefined\' as parameter', () => {
test('return \'a,e,i,o,u\'', () => {
expect(data.join(undefined)).toBe('a,e,i,o,u');
});
});
describe('when pass \'\' as parameter', () => {
test('return \'aeiou\'', () => {
expect(data.join('')).toBe('aeiou');
});
});
describe('when pass a string as parameter', () => {
test('return \'a-e-i-o-u\'', () => {
expect(data.join('-')).toBe('a-e-i-o-u');
});
});
describe('when pass a function as parameter', () => {
test('return \'a() => {}e() => {}i() => {}o() => {}u\'', () => {
expect(data.join(() => {})).toBe('a() => {}e() => {}i() => {}o() => {}u');
});
});
describe('when pass a object as parameter', () => {
test('return \'a[object Object]e[object Object]i[object Object]o[object Object]u\'', () => {
expect(data.join({})).toBe('a[object Object]e[object Object]i[object Object]o[object Object]u');
});
});
describe('when pass an array as parameter', () => {
test('return \'a1,2,3e1,2,3i1,2,3o1,2,3u\'', () => {
expect(data.join([1, 2, 3])).toBe('a1,2,3e1,2,3i1,2,3o1,2,3u');
});
});
describe('when pass a boolean as parameter', () => {
test('return \'atrueetrueitrueotrueu\'', () => {
expect(data.join(true)).toBe('atrueetrueitrueotrueu');
});
});
});