diff --git a/test/src/formatting/date-format.js b/test/src/formatting/date-format.js new file mode 100644 index 00000000..dbf4d606 --- /dev/null +++ b/test/src/formatting/date-format.js @@ -0,0 +1,18 @@ +import { expect } from 'chai'; +import { DateFormat } from 'util/formatting/date-format'; + +describe('DateFormat', () => { + const dt = new Date(2020, 0, 2, 3, 4, 5, 6); + + it('should format date', () => { + expect(DateFormat.dStr(dt)).to.eql('2 Jan 2020'); + }); + + it('should format date and time', () => { + expect(DateFormat.dtStr(dt)).to.eql('2 Jan 2020 03:04:05'); + }); + + it('should format date and time in sortable format', () => { + expect(DateFormat.dtStrFs(dt)).to.eql('2020-01-02T03-04-05'); + }); +}); diff --git a/test/src/formatting/icon-url-format.js b/test/src/formatting/icon-url-format.js new file mode 100644 index 00000000..1538ed78 --- /dev/null +++ b/test/src/formatting/icon-url-format.js @@ -0,0 +1,10 @@ +import { expect } from 'chai'; +import { IconUrlFormat } from 'util/formatting/icon-url-format'; + +describe('IconUrlFormat', () => { + it('should convert to dataurl', () => { + expect(IconUrlFormat.toDataUrl(new Uint8Array([1, 2]))).to.eql( + 'data:image/png;base64,AQI=' + ); + }); +});