mirror of
https://github.com/CzBiX/qb-web.git
synced 2026-04-14 02:10:31 +08:00
Fix unit test
This commit is contained in:
@@ -90,7 +90,7 @@ export function formatDuration(value: number, options?: DurationOptions) {
|
||||
|
||||
Vue.filter('formatDuration', formatDuration);
|
||||
|
||||
export function formatTimestamp(timestamp: number) {
|
||||
export function formatTimestamp(timestamp: number | null) {
|
||||
if (timestamp == null || timestamp === -1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ describe('format size', () => {
|
||||
|
||||
describe('format duration', () => {
|
||||
test.each([
|
||||
[0, null, '0'],
|
||||
[0, undefined, '0'],
|
||||
[3600 * 24, { dayLimit: 1 }, '∞'],
|
||||
[3600 * 24, null, '1d'],
|
||||
[3600 * 26, null, '1d 2h'],
|
||||
[3600 * 24, undefined, '1d'],
|
||||
[3600 * 26, undefined, '1d 2h'],
|
||||
])('case %#', (value, options, result) => {
|
||||
expect(formatDuration(value, options)).toEqual(result);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user