test: narrow channels status command mocks

This commit is contained in:
Peter Steinberger
2026-04-17 08:12:06 +01:00
parent c93b2540ec
commit efb37f8949

View File

@@ -51,6 +51,50 @@ vi.mock("../channels/plugins/index.js", () => ({
(mocks.listChannelPlugins() as Array<{ id: string }>).find((plugin) => plugin.id === channel),
}));
vi.mock("../channels/account-snapshot-fields.js", () => ({
hasConfiguredUnavailableCredentialStatus: (account: Record<string, unknown>) =>
Object.values(account).includes("configured_unavailable"),
hasResolvedCredentialValue: (account: Record<string, unknown>) =>
["token", "botToken", "appToken", "signingSecret"].some(
(key) => typeof account[key] === "string" && account[key].length > 0,
),
}));
vi.mock("../channels/plugins/status.js", () => ({
buildReadOnlySourceChannelAccountSnapshot: async ({
plugin,
cfg,
accountId,
}: {
plugin: ReturnType<typeof createTokenOnlyPlugin>;
cfg: { secretResolved?: boolean };
accountId: string;
}) => ({
accountId,
...plugin.config.inspectAccount(cfg),
}),
buildChannelAccountSnapshot: async ({
plugin,
cfg,
accountId,
}: {
plugin: ReturnType<typeof createTokenOnlyPlugin>;
cfg: { secretResolved?: boolean };
accountId: string;
}) => ({
accountId,
...plugin.config.resolveAccount(cfg),
}),
}));
vi.mock("../cli/command-secret-targets.js", () => ({
getChannelsCommandSecretTargetIds: () => [],
}));
vi.mock("../infra/channels-status-issues.js", () => ({
collectChannelStatusIssues: () => [],
}));
vi.mock("../cli/progress.js", () => ({
withProgress: (opts: unknown, run: () => Promise<unknown>) => mocks.withProgress(opts, run),
}));