-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_moneyFormat.spec.js
40 lines (35 loc) · 996 Bytes
/
_moneyFormat.spec.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
import { should } from 'chai';
import _moneyFormat from '../source/_moneyFormat';
should();
describe('moneyFormat', () => {
describe('valid arg', () => {
it('0 -> 0', () => {
_moneyFormat(0).should.equal('0');
});
it('999 -> 999', () => {
_moneyFormat(999).should.equal('999');
});
it('1000 -> 1,000', () => {
_moneyFormat(1000).should.equal('1,000');
});
it('999999 -> 999,999', () => {
_moneyFormat(999999).should.equal('999,999');
});
it('1000000 -> 1,000,000', () => {
_moneyFormat(1000000).should.equal('1,000,000');
});
it('999999999 -> 999,999,999', () => {
_moneyFormat(999999999).should.equal('999,999,999');
});
});
describe('invalid arg', () => {
it('string', () => {
const compared = _moneyFormat('12') == null;
compared.should.equal(true);
});
it('array', () => {
const compared = _moneyFormat([]) == null;
compared.should.equal(true);
});
})
})