mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:01:23 +00:00
test: dedupe empty-array counter checks in sandbox formatters
This commit is contained in:
@@ -91,10 +91,6 @@ describe("sandbox-formatters", () => {
|
||||
expect(countRunning(items)).toBe(2);
|
||||
});
|
||||
|
||||
it("should return 0 for empty array", () => {
|
||||
expect(countRunning([])).toBe(0);
|
||||
});
|
||||
|
||||
it("should return 0 when no items running", () => {
|
||||
const items = [
|
||||
{ running: false, name: "a" },
|
||||
@@ -128,10 +124,6 @@ describe("sandbox-formatters", () => {
|
||||
expect(countMismatches(items)).toBe(3);
|
||||
});
|
||||
|
||||
it("should return 0 for empty array", () => {
|
||||
expect(countMismatches([])).toBe(0);
|
||||
});
|
||||
|
||||
it("should return 0 when all match", () => {
|
||||
const items = [
|
||||
{ imageMatch: true, name: "a" },
|
||||
@@ -151,4 +143,13 @@ describe("sandbox-formatters", () => {
|
||||
expect(countMismatches(items)).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe("counter empty inputs", () => {
|
||||
it.each([
|
||||
{ fn: countRunning as (items: unknown[]) => number },
|
||||
{ fn: countMismatches as (items: unknown[]) => number },
|
||||
])("should return 0 for empty array", ({ fn }) => {
|
||||
expect(fn([])).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user