mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 23:00:43 +00:00
test: tighten task registry upsert assertion
This commit is contained in:
@@ -21,6 +21,15 @@ import type { TaskRecord } from "./task-registry.types.js";
|
||||
|
||||
const ORIGINAL_STATE_DIR = process.env.OPENCLAW_STATE_DIR;
|
||||
|
||||
function requireFirstUpsertParams(upsertTaskWithDeliveryState: ReturnType<typeof vi.fn>): unknown {
|
||||
const params = upsertTaskWithDeliveryState.mock.calls[0]?.[0];
|
||||
expect(params).toBeDefined();
|
||||
if (!params) {
|
||||
throw new Error("expected task upsert params");
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
function createStoredTask(): TaskRecord {
|
||||
return {
|
||||
taskId: "task-restored",
|
||||
@@ -174,7 +183,7 @@ describe("task-registry store runtime", () => {
|
||||
expect(deleteTaskRecordById(created.taskId)).toBe(true);
|
||||
|
||||
expect(upsertTaskWithDeliveryState).toHaveBeenCalled();
|
||||
expect(upsertTaskWithDeliveryState.mock.calls[0]?.[0]).toMatchObject({
|
||||
expect(requireFirstUpsertParams(upsertTaskWithDeliveryState)).toMatchObject({
|
||||
task: expect.objectContaining({
|
||||
taskId: created.taskId,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user