Skip to content

Commit

Permalink
unit test for small numbers, maxSmall
Browse files Browse the repository at this point in the history
  • Loading branch information
erosson committed Dec 4, 2017
1 parent 7beeed1 commit dd3d32a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/format.test.js
Expand Up @@ -247,4 +247,12 @@ describe('numberformat', () => {
expect(f.format(1.23e9, {format: 'standard', sigfigs: 0})).toBe('1.23 billion')
})
}
it('has crude support for smallish numbers with maxSmall', () => {
const formatter = numberformat
expect(formatter.format(0.12)).toBe('0')
expect(formatter.format(0.12, {maxSmall: '10'})).toBe('0.12')
expect(formatter.format(9.12, {maxSmall: '10'})).toBe('9.12')
expect(formatter.format(10.12, {maxSmall: '10'})).toBe('10')
expect(formatter.format(0.123456789, {maxSmall: '10', sigfigs: 2})).toBe('0.12')
})
});

0 comments on commit dd3d32a

Please sign in to comment.