Fix unit test

This commit is contained in:
CzBiX
2019-12-31 18:29:26 +08:00
parent d043ffbc7c
commit 381044f3a4
2 changed files with 4 additions and 4 deletions

View File

@@ -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 '';
}

View File

@@ -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);
});