

























1-// Sandbox formatter tests cover duration, mismatch, and sandbox diagnostic display helpers.
1+// Sandbox formatter tests cover duration and sandbox diagnostic display helpers.
22import { describe, expect, it } from "vitest";
33import { formatDurationCompact } from "../infra/format-time/format-duration.js";
4-import {
5-countMismatches,
6-countRunning,
7-formatImageMatch,
8-formatSimpleStatus,
9-formatStatus,
10-} from "./sandbox-formatters.js";
4+import { formatImageMatch, formatSimpleStatus, formatStatus } from "./sandbox-formatters.js";
115126/** Helper matching old formatAge behavior: spaced compound duration */
137const formatAge = (ms: number) => formatDurationCompact(ms, { spaced: true }) ?? "0s";
@@ -63,76 +57,4 @@ describe("sandbox-formatters", () => {
6357expect(formatAge(ms)).toBe(expected);
6458});
6559});
66-67-describe("countRunning", () => {
68-it.each([
69-{
70-items: [
71-{ running: true, name: "a" },
72-{ running: false, name: "b" },
73-{ running: true, name: "c" },
74-{ running: false, name: "d" },
75-],
76-expected: 2,
77-},
78-{
79-items: [
80-{ running: false, name: "a" },
81-{ running: false, name: "b" },
82-],
83-expected: 0,
84-},
85-{
86-items: [
87-{ running: true, name: "a" },
88-{ running: true, name: "b" },
89-{ running: true, name: "c" },
90-],
91-expected: 3,
92-},
93-])("counts running items", ({ items, expected }) => {
94-expect(countRunning(items)).toBe(expected);
95-});
96-});
97-98-describe("countMismatches", () => {
99-it.each([
100-{
101-items: [
102-{ imageMatch: true, name: "a" },
103-{ imageMatch: false, name: "b" },
104-{ imageMatch: true, name: "c" },
105-{ imageMatch: false, name: "d" },
106-{ imageMatch: false, name: "e" },
107-],
108-expected: 3,
109-},
110-{
111-items: [
112-{ imageMatch: true, name: "a" },
113-{ imageMatch: true, name: "b" },
114-],
115-expected: 0,
116-},
117-{
118-items: [
119-{ imageMatch: false, name: "a" },
120-{ imageMatch: false, name: "b" },
121-{ imageMatch: false, name: "c" },
122-],
123-expected: 3,
124-},
125-])("counts image mismatches", ({ items, expected }) => {
126-expect(countMismatches(items)).toBe(expected);
127-});
128-});
129-130-describe("counter empty inputs", () => {
131-it.each([
132-{ fn: countRunning as (items: unknown[]) => number },
133-{ fn: countMismatches as (items: unknown[]) => number },
134-])("should return 0 for empty array", ({ fn }) => {
135-expect(fn([])).toBe(0);
136-});
137-});
13860});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。