-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspaces.test.js
46 lines (37 loc) · 1.05 KB
/
spaces.test.js
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
const tpl = require('..')
test('Spaces in front', () => {
const who = 'World'
const result = `Hello, ${ who}`
expect(tpl('Hello, ${ who}', { who }))
.toBe(result);
});
test('Spaces on the end', () => {
const who = 'World'
const result = `Hello, ${who }`
expect(tpl('Hello, ${who }', { who: 'World' }))
.toBe(result);
});
test('Spaces on both sides', () => {
const who = 'World'
const result = `Hello, ${ who }`
expect(tpl('Hello, ${ who }', { who: 'World' }))
.toBe(result);
});
test('Multiple spaces', () => {
const who = 'World'
const result = `Hello, ${ who }`
expect(tpl('Hello, ${ who }', { who: 'World' }))
.toBe(result);
});
test('Tabs', () => {
const who = 'World'
const result = `Hello, ${ who }`
expect(tpl('Hello, ${\twho\t}', { who: 'World' }))
.toBe(result);
});
test('Tabs & spaces', () => {
const who = 'World'
const result = `Hello, ${ who }`
expect(tpl('Hello, ${ \t who \t}', { who: 'World' }))
.toBe(result);
});