




















@@ -224,15 +224,11 @@ describe("channelsStatusCommand SecretRef fallback flow", () => {
224224225225await channelsStatusCommand({ probe: false }, runtime as never);
226226227-expect(errors).toEqual(
228-expect.arrayContaining([expect.stringContaining("Gateway not reachable")]),
229-);
230-expect(mocks.resolveCommandConfigWithSecrets).toHaveBeenCalledWith(
231-expect.objectContaining({
232-commandName: "channels status",
233-mode: "read_only_status",
234-}),
235-);
227+expect(errors.join("\n")).toContain("Gateway not reachable");
228+expect(mocks.resolveCommandConfigWithSecrets).toHaveBeenCalledOnce();
229+const configResolutionRequest = mocks.resolveCommandConfigWithSecrets.mock.calls[0]?.[0];
230+expect(configResolutionRequest?.commandName).toBe("channels status");
231+expect(configResolutionRequest?.mode).toBe("read_only_status");
236232expect(
237233logs.some((line) =>
238234line.includes("[secrets] channels status: channels.discord.token is unavailable"),
@@ -307,12 +303,13 @@ describe("channelsStatusCommand SecretRef fallback flow", () => {
307303await channelsStatusCommand({ json: true, probe: false }, runtime as never);
308304309305expect(mocks.listChannelPlugins).not.toHaveBeenCalled();
310-expect(mocks.listConfiguredChannelIdsForReadOnlyScope).toHaveBeenCalledWith(
311-expect.objectContaining({
312-config: expect.objectContaining({ secretResolved: true }),
313-includePersistedAuthState: false,
314-}),
315-);
306+expect(mocks.listConfiguredChannelIdsForReadOnlyScope).toHaveBeenCalledOnce();
307+const readOnlyScopeRequest = mocks.listConfiguredChannelIdsForReadOnlyScope.mock
308+.calls[0]?.[0] as
309+| { config?: { secretResolved?: unknown }; includePersistedAuthState?: unknown }
310+| undefined;
311+expect(readOnlyScopeRequest?.config?.secretResolved).toBe(true);
312+expect(readOnlyScopeRequest?.includePersistedAuthState).toBe(false);
316313const payload = JSON.parse(logs.at(-1) ?? "{}");
317314expect(errors.join("\n")).not.toContain("user:pass");
318315expect(errors.join("\n")).not.toContain("secret-token");
@@ -323,12 +320,8 @@ describe("channelsStatusCommand SecretRef fallback flow", () => {
323320expect(payload.error).not.toContain("secret-token");
324321expect(payload.error).not.toContain("fallback-user:fallback-pass");
325322expect(payload.error).not.toContain("fallback-secret");
326-expect(payload).toEqual(
327-expect.objectContaining({
328-gatewayReachable: false,
329-configOnly: true,
330-configuredChannels: ["discord"],
331-}),
332-);
323+expect(payload.gatewayReachable).toBe(false);
324+expect(payload.configOnly).toBe(true);
325+expect(payload.configuredChannels).toStrictEqual(["discord"]);
333326});
334327});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。