mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-05-08 08:08:33 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { summarizeStringEntries } from "./string-sample.js";
|
|
|
|
describe("summarizeStringEntries", () => {
|
|
it("returns emptyText for empty lists", () => {
|
|
expect(summarizeStringEntries({ entries: [], emptyText: "any" })).toBe("any");
|
|
expect(summarizeStringEntries({ entries: null })).toBe("");
|
|
});
|
|
|
|
it("joins short lists without a suffix", () => {
|
|
expect(summarizeStringEntries({ entries: ["a", "b"], limit: 4 })).toBe("a, b");
|
|
});
|
|
|
|
it("adds a remainder suffix when truncating", () => {
|
|
expect(
|
|
summarizeStringEntries({
|
|
entries: ["a", "b", "c", "d", "e"],
|
|
limit: 4,
|
|
}),
|
|
).toBe("a, b, c, d (+1)");
|
|
});
|
|
|
|
it("uses a floored limit and clamps non-positive values to one entry", () => {
|
|
expect(
|
|
summarizeStringEntries({
|
|
entries: ["a", "b", "c"],
|
|
limit: 2.8,
|
|
}),
|
|
).toBe("a, b (+1)");
|
|
expect(
|
|
summarizeStringEntries({
|
|
entries: ["a", "b", "c"],
|
|
limit: 0,
|
|
}),
|
|
).toBe("a (+2)");
|
|
});
|
|
|
|
it("uses the default limit when none is provided", () => {
|
|
expect(
|
|
summarizeStringEntries({
|
|
entries: ["a", "b", "c", "d", "e", "f", "g"],
|
|
}),
|
|
).toBe("a, b, c, d, e, f (+1)");
|
|
});
|
|
|
|
it("does not add a suffix when the limit exactly matches the entry count", () => {
|
|
expect(
|
|
summarizeStringEntries({
|
|
entries: ["a", "b", "c"],
|
|
limit: 3,
|
|
emptyText: "ignored",
|
|
}),
|
|
).toBe("a, b, c");
|
|
});
|
|
});
|