Repository navigation
Expand file tree
/
Copy pathtest.js
More file actions
82 lines (77 loc) · 1.75 KB
/
Copy pathtest.js
File metadata and controls
82 lines (77 loc) · 1.75 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const assert = require('assert')
const t = require('.')
CamelCase: {
;[
['hi there', 'hiThere'],
['hi-there', 'hiThere'],
['hi_there_1', 'hiThere1'],
[' hi_there ', 'hiThere'],
['1ApplePlease', '1ApplePlease'],
['CON_STAT', 'conStat'],
['CaseStatus', 'caseStatus'],
].forEach(([input, expected]) => {
assert.strictEqual(
t.camelCase(input),
expected,
`${t.camelCase(input)} !== ${expected}`,
)
})
}
PascalCase: {
;[
['hi there', 'HiThere'],
['hi-there', 'HiThere'],
['hi_there_1', 'HiThere1'],
[' hi_there ', 'HiThere'],
['1ApplePlease', '1ApplePlease'],
].forEach(([input, expected]) => {
assert.strictEqual(
t.pascalCase(input),
expected,
`${t.pascalCase(input)} !== ${expected}`,
)
})
}
SnakeCase: {
;[
['hi there', 'hi_there'],
['hi-there', 'hi_there'],
['hi_there_1', 'hi_there_1'],
[' hi_there ', 'hi_there'],
['1ApplePlease', '1_apple_please'],
].forEach(([input, expected]) => {
assert.strictEqual(
t.snakeCase(input),
expected,
`${t.snakeCase(input)} !== ${expected}`,
)
})
}
SentenceCase: {
;[
['hi there', 'Hi there'],
['hi-There', 'Hi there'],
['hi_there_1', 'Hi there 1'],
[' hi_there ', 'Hi there'],
].forEach(([input, expected]) => {
assert.strictEqual(
t.sentenceCase(input),
expected,
`${t.sentenceCase(input)} !== ${expected}`,
)
})
}
TitleCase: {
;[
['hi there', 'Hi There'],
['hi-There', 'Hi There'],
['hi_there_1', 'Hi There 1'],
[' hi_there ', 'Hi There'],
].forEach(([input, expected]) => {
assert.strictEqual(
t.titleCase(input),
expected,
`${t.titleCase(input)} !== ${expected}`,
)
})
}