
























@@ -17,6 +17,21 @@ vi.mock("../plugins/provider-runtime.js", () => ({
1717resolveExternalAuthProfilesWithPlugins: () => [],
1818}));
191920+function getEmbeddedPiAgentParams(): {
21+authProfileId?: string;
22+authProfileIdSource?: string;
23+} {
24+const [call] = vi.mocked(runEmbeddedPiAgent).mock.calls;
25+if (!call) {
26+throw new Error("Expected embedded PI agent call for auth profile propagation");
27+}
28+const [params] = call;
29+if (typeof params !== "object" || params === null || Array.isArray(params)) {
30+throw new Error("Expected embedded PI agent params to be an object");
31+}
32+return params;
33+}
34+2035describe("runCronIsolatedAgentTurn auth profile propagation (#20624)", () => {
2136beforeEach(() => {
2237setupIsolatedAgentTurnMocks({ fast: true });
@@ -84,15 +99,7 @@ describe("runCronIsolatedAgentTurn auth profile propagation (#20624)", () => {
8499expect(vi.mocked(runEmbeddedPiAgent)).toHaveBeenCalledTimes(1);
8510086101// 5. Check that authProfileId was passed
87-const callArgs = vi.mocked(runEmbeddedPiAgent).mock.calls[0]?.[0] as
88-| {
89-authProfileId?: string;
90-authProfileIdSource?: string;
91-}
92-| undefined;
93-if (!callArgs) {
94-throw new Error("Expected embedded PI agent call for auth profile propagation");
95-}
102+const callArgs = getEmbeddedPiAgentParams();
9610397104expect(callArgs.authProfileId).toBe("openrouter:default");
98105});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。