deno.land / x / urlcat@v3.1.0 / test / join.ts

نووسراو ببینە
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
54
55
56
57
58
59
60
61
62
63
64
65
66
import { join } from '../src';
describe('join', () => {
it('Returns empty string if all arguments are empty', () => { const expected = ''; const actual = join('', '', ''); expect(actual).toBe(expected); });
it('Returns empty string if the separator is specified but the two parts are empty', () => { const expected = ''; const actual = join('', '&', ''); expect(actual).toBe(expected); });
it('Removes the separator at the beginning of the second part if the first part is empty', () => { const expected = 'second-part'; const actual = join('', '&', '&second-part'); expect(actual).toBe(expected); });
it('Removes the separator at the end of the first part if the second part is empty', () => { const expected = 'first-part'; const actual = join('first-part&', '&', ''); expect(actual).toBe(expected); });
it('If neither part contains the separator at the boundary, it joins them using it', () => { const expected = 'first,second'; const actual = join('first', ',', 'second'); expect(actual).toBe(expected); });
it('Ignores the separator if it is not at the boundary', () => { const expected = 'a|b|c||de|f'; const actual = join('a|b', '|', '|c||de|f'); expect(actual).toBe(expected); });
it('Uses exactly one separator even if the first part ends with it', () => { const expected = 'first,second'; const actual = join('first,', ',', 'second'); expect(actual).toBe(expected); });
it('Uses exactly one separator even if the second part starts with it', () => { const expected = 'first,second'; const actual = join('first', ',', ',second'); expect(actual).toBe(expected); });
it('Uses exactly one separator even if the first part ends with it and the second part starts with it', () => { const expected = 'first,second'; const actual = join('first,', ',', ',second'); expect(actual).toBe(expected); });
it('Uses the separator if it is not present at the boundary', () => { const expected = 'first,second'; const actual = join('first', ',', 'second'); expect(actual).toBe(expected); });
});
urlcat

Version Info

Tagged at
a year ago