From 381044f3a449421aca850cc1cceca349e10a6ff3 Mon Sep 17 00:00:00 2001 From: CzBiX Date: Tue, 31 Dec 2019 18:29:26 +0800 Subject: [PATCH] Fix unit test --- src/filters.ts | 2 +- tests/unit/filters.spec.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/filters.ts b/src/filters.ts index 9dcfa30..33b6a5b 100644 --- a/src/filters.ts +++ b/src/filters.ts @@ -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 ''; } diff --git a/tests/unit/filters.spec.ts b/tests/unit/filters.spec.ts index 7a1f803..bc27ff7 100644 --- a/tests/unit/filters.spec.ts +++ b/tests/unit/filters.spec.ts @@ -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); });