Skip to content

Commit 955ce17

Browse files
committed
fix: match integration summary plurality to displayed names
1 parent c2e6f1c commit 955ce17

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎packages/client-runtime/src/work-log/presentation.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,28 @@ describe("summarizeToolGroup", () => {
253253
).toBe("Used Chrome integration and ran 1 command");
254254
});
255255

256+
it.each([
257+
[["Foo", "Foo"], "Used Foo integration and ran 1 command"],
258+
[["Foo", "Bar", "Foo"], "Used Foo and Bar integrations and ran 1 command"],
259+
] as const)(
260+
"uses the displayed source names for integration plurality: %j",
261+
(names, expected) => {
262+
expect(
263+
summarizeToolGroup([
264+
...names.map((name, index) =>
265+
entry(`integration-${index}`, {
266+
toolSource: { key: `integration-${index}`, name, kind: "integration" },
267+
}),
268+
),
269+
entry("command", {
270+
itemType: "command_execution",
271+
command: "git status",
272+
}),
273+
]).summary,
274+
).toBe(expected);
275+
},
276+
);
277+
256278
it("omits the integration suffix for special browser and computer sources", () => {
257279
expect(
258280
summarizeToolGroup([

‎packages/client-runtime/src/work-log/presentation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ export function summarizeToolGroup(entries: ReadonlyArray<WorkLogPresentationEnt
706706
: `${sourceNames.slice(0, -1).join(", ")}, and ${sourceNames.at(-1)}`;
707707
const allIntegrations = sourceValues.every((source) => source.kind === "integration");
708708
labels.unshift(
709-
`Used ${formattedNames}${allIntegrations ? ` ${sources.size === 1 ? "integration" : "integrations"}` : ""}`,
709+
`Used ${formattedNames}${allIntegrations ? ` ${sourceNames.length === 1 ? "integration" : "integrations"}` : ""}`,
710710
);
711711
}
712712
const sourcedCount = entries.filter(

0 commit comments

Comments
 (0)