mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 11:58:10 +08:00
22 lines
634 B
TypeScript
22 lines
634 B
TypeScript
import {
|
|
prettyBytes,
|
|
escapeHtml,
|
|
formatDuration
|
|
} from '../../src/utils/tpl-builtin';
|
|
|
|
test('tpl-builtin:prettyBytes', () => {
|
|
expect(prettyBytes(1024)).toEqual('1.02 kB');
|
|
expect(prettyBytes(1024000)).toEqual('1.02 MB');
|
|
});
|
|
|
|
|
|
test('tpl-builtin:escapeHtml', () => {
|
|
expect(escapeHtml('<div id="1">Hello&world</div>')).toEqual('<div id="1">Hello&world</div>');
|
|
});
|
|
|
|
test('tpl-builtin:formatDuration', () => {
|
|
expect(formatDuration(1)).toEqual('1秒');
|
|
expect(formatDuration(61)).toEqual('1分1秒');
|
|
expect(formatDuration(233233)).toEqual('3天17时47分13秒');
|
|
|
|
}) |