Files
AstrBot/dashboard/tests/routerReadiness.test.mjs
LIghtJUNction bc01532e59 fix(provider): filter abort_signal from payloads to avoid JSON serialize error
`abort_signal` (asyncio.Event) is passed via **kwargs into payloads during
tool_call streaming, causing "Object of type Event is not JSON serializable"
when the OpenAI client tries to serialize the request body.

Regression test added: test_prepare_chat_payload_strips_non_json_serializable_kwargs
2026-03-28 01:15:21 +08:00

32 lines
812 B
JavaScript

import test from "node:test";
import assert from "node:assert/strict";
test("waitForRouterReadyInBackground returns immediately and logs failures", async () => {
const module = await import("../src/utils/routerReadiness.mjs").catch(
() => null,
);
assert.ok(module?.waitForRouterReadyInBackground);
const error = new Error("router blocked");
let warned;
const readyPromise = Promise.reject(error);
const logger = {
warn: (message, cause) => {
warned = { message, cause };
},
};
const result = module.waitForRouterReadyInBackground(
{ isReady: () => readyPromise },
logger,
);
assert.equal(result, undefined);
await Promise.resolve();
assert.deepEqual(warned, {
message: "Router did not become ready after fallback mount:",
cause: error,
});
});