-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
40 lines (33 loc) · 715 Bytes
/
index.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
var assert = require('assert')
var capital = require('..')
/**
* Cases.
*/
var strings = {
camel: 'thisIsAString',
capital: 'This Is A String',
constant: 'THIS_IS_A_STRING',
dot: 'this.is.a.string',
pascal: 'ThisIsAString',
sentence: 'This is a string.',
snake: 'this_is_a_string',
space: 'this is a string',
title: 'This Is a String',
junk: '-this__is$%a-string...'
}
/**
* Tests.
*/
describe('to-capital-case', function () {
for (var key in strings) test(key)
})
/**
* Create a test for a given case `key`.
*
* @param {String} key
*/
function test(key) {
it('should convert ' + key + ' case', function () {
assert.equal(capital(strings[key]), 'This Is A String')
})
}