


























@@ -157,16 +157,24 @@ describe("server-channels approval bootstrap", () => {
157157await manager.startChannels();
158158await started.promise;
159159160-expect(hoisted.startChannelApprovalHandlerBootstrap).toHaveBeenCalledWith(
161-expect.objectContaining({
162-plugin: expect.objectContaining({ id: "discord" }),
163-cfg: {},
164-accountId: DEFAULT_ACCOUNT_ID,
165-channelRuntime: expect.objectContaining({
166-runtimeContexts: expect.any(Object),
167-}),
168-}),
169-);
160+const approvalBootstrapCalls = hoisted.startChannelApprovalHandlerBootstrap.mock
161+.calls as unknown as Array<
162+[
163+{
164+plugin: ChannelPlugin;
165+cfg: unknown;
166+accountId?: string;
167+channelRuntime?: PluginRuntime["channel"];
168+},
169+]
170+>;
171+const approvalBootstrapArg = approvalBootstrapCalls.at(-1)?.[0];
172+expect(approvalBootstrapArg?.plugin.id).toBe("discord");
173+expect(approvalBootstrapArg?.cfg).toEqual({});
174+expect(approvalBootstrapArg?.accountId).toBe(DEFAULT_ACCOUNT_ID);
175+expect(typeof approvalBootstrapArg?.channelRuntime?.runtimeContexts.register).toBe("function");
176+expect(typeof approvalBootstrapArg?.channelRuntime?.runtimeContexts.get).toBe("function");
177+expect(typeof approvalBootstrapArg?.channelRuntime?.runtimeContexts.watch).toBe("function");
170178expect(
171179channelRuntime.runtimeContexts.get({
172180channelId: "discord",
@@ -217,14 +225,10 @@ describe("server-channels approval bootstrap", () => {
217225expect(startAccount).toHaveBeenCalledTimes(1);
218226const accountSnapshot =
219227manager.getRuntimeSnapshot().channelAccounts.discord?.[DEFAULT_ACCOUNT_ID];
220-expect(accountSnapshot).toEqual(
221-expect.objectContaining({
222-accountId: DEFAULT_ACCOUNT_ID,
223-running: true,
224-restartPending: false,
225-lastError: null,
226-}),
227-);
228+expect(accountSnapshot?.accountId).toBe(DEFAULT_ACCOUNT_ID);
229+expect(accountSnapshot?.running).toBe(true);
230+expect(accountSnapshot?.restartPending).toBe(false);
231+expect(accountSnapshot?.lastError).toBeNull();
228232229233await manager.stopChannel("discord", DEFAULT_ACCOUNT_ID);
230234await stopped.promise;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。