

















@@ -138,7 +138,7 @@ describe("commands registry", () => {
138138textAliases: ["/btw", "/side"],
139139});
140140expect(normalizeCommandBody("/side what changed?")).toBe("/btw what changed?");
141-expect(findCommandByNativeName("side")?.key).toBe("btw");
141+expect(requireNativeCommand("side").key).toBe("btw");
142142expect(listNativeCommandSpecs().find((spec) => spec.name === "side")).toMatchObject({
143143acceptsArgs: true,
144144});
@@ -217,7 +217,7 @@ describe("commands registry", () => {
217217{ provider: "discord" },
218218);
219219expect([...nativeNameSet(native)]).toContain("voice");
220-expect(findCommandByNativeName("voice", "discord")?.key).toBe("tts");
220+expect(requireNativeCommand("voice", "discord").key).toBe("tts");
221221expect(findCommandByNativeName("tts", "discord")).toBeUndefined();
222222});
223223@@ -228,7 +228,7 @@ describe("commands registry", () => {
228228{ provider: "slack" },
229229);
230230expect([...nativeNameSet(native)]).toContain("agentstatus");
231-expect(findCommandByNativeName("agentstatus", "slack")?.key).toBe("status");
231+expect(requireNativeCommand("agentstatus", "slack").key).toBe("status");
232232expect(findCommandByNativeName("status", "slack")).toBeUndefined();
233233expect(
234234findCommandByNativeName("agentstatus", "slack", {
@@ -243,11 +243,10 @@ describe("commands registry", () => {
243243});
244244245245it("can resolve default native command names without loading bundled channel fallbacks", () => {
246-expect(
247-findCommandByNativeName("status", "discord", {
248-includeBundledChannelFallback: false,
249-})?.key,
250-).toBe("status");
246+const command = findCommandByNativeName("status", "discord", {
247+includeBundledChannelFallback: false,
248+});
249+expect(command).toMatchObject({ key: "status" });
251250});
252251253252it("keeps discord native command specs within slash-command limits", () => {
@@ -262,7 +261,7 @@ describe("commands registry", () => {
262261263262const command = requireNativeCommand(spec.name, "discord");
264263265-const args = command?.args ?? spec.args ?? [];
264+const args = command.args ?? spec.args ?? [];
266265const argNames = new Set<string>();
267266let sawOptional = false;
268267for (const arg of args) {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。