Skip to content

Commit

Permalink
test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
scurker committed Aug 2, 2017
1 parent 7d4adc0 commit 566fbdd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
**1.0.0**

* Node < 4 support dropped.
* Separate UMD, CommonJS modules now available.
* Global currency settings removed. Settings are now passed per currency.js instance.
* Different precision currencies supported. (#29)
* Different precision currencies supported. ([#29](https://github.com/scurker/currency.js/issues/29))

**0.4.4**

Expand Down
14 changes: 11 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ test('should default to 0 with invalid strings', t => {
t.is(currency('abc').value, 0, 'currency("abc") is 0');
});

test('should return value', t => {
t.is(currency(1.23).value, 1.23, 'currency.value exists');
});

test('should return intValue', t => {
t.is(currency(1.23).intValue, 123, 'currency.intValue exists');
});

test('should add floating point value', t => {
var value = currency(2.51).add(.01);

Expand Down Expand Up @@ -228,9 +236,9 @@ test('should format value using international', t => {
test('should parse international values', t => {
let c = value => currency(value, { separator: '.', decimal: ',' });

t.is(c('1,23').format(), '1,23', 'value is "1,23"');
t.is(c('1.000,00').format(), '1.000,00', 'value is "1.000,00"');
t.is(c('1.000.000,00').format(), '1.000.000,00', 'value is "1.000.000,00"');
t.is(c('1,23').value, 1.23, 'value is "1.23"');
t.is(c('1.000,00').value, 1000.00, 'value is "1,000.00"');
t.is(c('1.000.000,00').value, 1000000.00, 'value is "1,000,000.00"');
});

test('should format with symbol', t => {
Expand Down

0 comments on commit 566fbdd

Please sign in to comment.