mirror of https://github.com/keeweb/keeweb.git
format tests
This commit is contained in:
parent
4f53e39f8d
commit
b96b477f65
|
@ -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');
|
||||
});
|
||||
});
|
|
@ -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='
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue