mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix test not running
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
parent
501613edcf
commit
968fa52958
@ -23,8 +23,12 @@ export function formatDuration(timeValue: number, compact: boolean) {
|
||||
.filter(([_dur, suf], i) => i === 0 || suf !== "s") // remove seconds, unless it is the only one
|
||||
.map(([dur, suf]) => dur + suf);
|
||||
|
||||
if (meaningfulValues.length === 0) {
|
||||
return "0s";
|
||||
}
|
||||
|
||||
if (compact) {
|
||||
return meaningfulValues[0] || "0s";
|
||||
return meaningfulValues[0];
|
||||
}
|
||||
|
||||
return meaningfulValues.join(" ");
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { formatDuration } from "../formatDuration";
|
||||
import { formatDuration } from "./formatDuration";
|
||||
|
||||
const second = 1000;
|
||||
const minute = 60 * second;
|
||||
@ -45,9 +45,7 @@ describe("human format durations", () => {
|
||||
});
|
||||
|
||||
test("zero duration should output something", () => {
|
||||
const zero = formatDuration(0, false);
|
||||
|
||||
expect(zero).not.toHaveLength(0);
|
||||
expect(zero).toBe("0s");
|
||||
expect(formatDuration(0, false)).toBe("0s");
|
||||
expect(formatDuration(0, true)).toBe("0s");
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user