forked from deathcap/ucfirst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
36 lines (31 loc) · 782 Bytes
/
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
'use strict';
const ucfirst = require('.');
const test = require('tape');
test('ascii', t => {
t.equals(ucfirst('hello'), 'Hello');
t.equals(ucfirst('abc'), 'Abc');
t.equals(ucfirst('h'), 'H');
t.equals(ucfirst('H'), 'H');
t.equals(ucfirst('Abc'), 'Abc');
t.equals(ucfirst('Hello'), 'Hello');
t.end();
});
test('unicode', t => {
t.equals(ucfirst('éllo'), 'Éllo');
t.equals(ucfirst('Éllo'), 'Éllo');
t.end();
});
test('empty', t => {
t.equals(ucfirst(''), '');
t.end();
});
test('nonstring throws', t => {
t.throws(() => ucfirst(undefined));
t.throws(() => ucfirst());
t.throws(() => ucfirst(null));
t.throws(() => ucfirst(false));
t.throws(() => ucfirst(true));
t.throws(() => ucfirst([]));
t.throws(() => ucfirst({}));
t.end();
});