mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 15:14:45 +00:00
test: guard acpx runtime mock calls
This commit is contained in:
@@ -111,7 +111,11 @@ function makeLeaseStore() {
|
||||
function readFirstEnsureSessionInput(ensure: {
|
||||
mock: { calls: Array<Array<unknown>> };
|
||||
}): Parameters<AcpRuntime["ensureSession"]>[0] {
|
||||
const input = ensure.mock.calls[0]?.[0];
|
||||
const [call] = ensure.mock.calls;
|
||||
if (!call) {
|
||||
throw new Error("Expected ensureSession to be called");
|
||||
}
|
||||
const [input] = call;
|
||||
if (typeof input !== "object" || input === null) {
|
||||
throw new Error("Expected ensureSession to be called with an input object");
|
||||
}
|
||||
|
||||
@@ -157,7 +157,11 @@ function createMockRuntime(overrides: Record<string, unknown> = {}) {
|
||||
}
|
||||
|
||||
function readFirstRuntimeFactoryInput(runtimeFactory: { mock: { calls: Array<Array<unknown>> } }) {
|
||||
const input = runtimeFactory.mock.calls[0]?.[0];
|
||||
const [call] = runtimeFactory.mock.calls;
|
||||
if (!call) {
|
||||
throw new Error("Expected runtimeFactory to be called");
|
||||
}
|
||||
const [input] = call;
|
||||
if (typeof input !== "object" || input === null) {
|
||||
throw new Error("Expected runtimeFactory to be called with an options object");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user