Skip to content

Commit

Permalink
chore: bump pretty-ms (apache#398)
Browse files Browse the repository at this point in the history
* chore: bump pretty-ms

* fix: unit test

* fix: Add unit test for colonNotation
  • Loading branch information
villebro authored and zhaoyongjie committed Nov 25, 2021
1 parent bb62276 commit ef9eaac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@types/d3-format": "^1.3.0",
"d3-format": "^1.3.2",
"pretty-ms": "^6.0.1"
"pretty-ms": "^7.0.0"
},
"peerDependencies": {
"@superset-ui/core": "^0.12.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ describe('createDurationFormatter()', () => {
expect(formatter(90)).toBe('1m 30s');
});
it('format milliseconds in human readable format with additional pretty-ms options', () => {
const colonNotationFormatter = createDurationFormatter({ colonNotation: true });
expect(colonNotationFormatter(10500)).toBe('0:10.5');
const zeroDecimalFormatter = createDurationFormatter({ secondsDecimalDigits: 0 });
expect(zeroDecimalFormatter(10500)).toBe('11s');
expect(zeroDecimalFormatter(10500)).toBe('10s');
const subMillisecondFormatter = createDurationFormatter({ formatSubMilliseconds: true });
expect(subMillisecondFormatter(100.40008)).toBe('100ms 400µs 80ns');
});
Expand Down

0 comments on commit ef9eaac

Please sign in to comment.