forked from angus-c/just
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
44 lines (40 loc) · 1.88 KB
/
Copy pathindex.js
File metadata and controls
44 lines (40 loc) · 1.88 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
var test = require('../util/test')(__filename);
var camelCase = require('../../packages/string-camel-case');
test('string with spaces', function(t) {
t.plan(2);
t.equal(camelCase('the quick brown fox'), 'theQuickBrownFox');
t.equal(camelCase('the quick brownfox'), 'theQuickBrownfox');
t.end();
});
test('string with punctuation', function(t) {
t.plan(4);
t.equal(camelCase('the_quick_brown_fox'), 'theQuickBrownFox');
t.equal(camelCase('the-quick-brown-fox'), 'theQuickBrownFox');
t.equal(camelCase('the*quick-brown_fox'), 'theQuickBrownFox');
t.equal(camelCase('the****quick-_-brown_:fox'), 'theQuickBrownFox');
t.end();
});
test('string with mixed spaces and punctuation', function(t) {
t.plan(2);
t.equal(camelCase('the_quick_brown_ fox'), 'theQuickBrownFox');
t.equal(camelCase('the** **quick-_-brown_:fox'), 'theQuickBrownFox');
t.end();
});
test('string with existing capitalization', function(t) {
t.plan(13);
t.equal(camelCase('theQuickBrownFox'), 'theQuickBrownFox');
t.equal(camelCase('TheQuickBrownFox'), 'theQuickBrownFox');
t.equal(camelCase('the Quick Brown Fox'), 'theQuickBrownFox');
t.equal(camelCase('The quick brown FOX'), 'theQuickBrownFox');
t.equal(camelCase('theQUICKBrownFox'), 'theQuickBrownFox');
t.equal(camelCase('behold theQuickBrownFox'), 'beholdTheQuickBrownFox');
// camel-case all-caps substrings if length >= 4
t.equal(camelCase('Behold theQUickBrownFox'), 'beholdTheQUickBrownFox');
t.equal(camelCase('Behold theQUIckBrownFox'), 'beholdTheQUIckBrownFox');
t.equal(camelCase('Behold theQUICkBrownFox'), 'beholdTheQuiCkBrownFox');
t.equal(camelCase('Behold theQUICKBrownFox'), 'beholdTheQuickBrownFox');
t.equal(camelCase('Behold theQUICKBrownFOXES'), 'beholdTheQuickBrownFoxes');
t.equal(camelCase('THE_QUICK_BROWN_FOX'), 'theQuickBrownFox');
t.equal(camelCase('THE_QUICK/BROWN_FOX'), 'theQuickBrownFox');
t.end();
});