Skip to content

Commit 08aae6e

Browse files
committed
test(rest): route the picker e2e stub engine's update/delete through the dispatch predicates (#7467)
check:engine-double-contract flagged the new stub: a fake looser than ObjectQL's update/delete is how #4434 shipped a dead route green. Both verbs now open with assertEngineUpdateDispatch/assertEngineDeleteDispatch from @objectstack/metadata-core (#5619). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CnMk7vfrt2zW7xvwLS3JDf
1 parent 3afadbd commit 08aae6e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

packages/rest/src/public-form-lookup-picker.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
* conversion chain is a different seam, untouched by this card.
2727
*/
2828
import { describe, expect, it, vi } from 'vitest';
29+
// The engine-double contract (#4434 / #5619): a fake engine's update/delete
30+
// must be exactly as strict as ObjectQL's dispatch, or a dead route ships with
31+
// its suite green. Both predicates live in metadata-core.
32+
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch } from '@objectstack/metadata-core';
2933
import { ObjectStackProtocolImplementation } from '@objectstack/metadata-protocol';
3034
import { RestServer } from './rest-server';
3135

@@ -46,8 +50,14 @@ function stubEngine() {
4650
rows.push({ id: `r_${nextId}`, ...data });
4751
return { id: `r_${nextId}` };
4852
},
49-
async update() { return { id: null }; },
50-
async delete() { return { deleted: 0 }; },
53+
async update(_t: string, data: Record<string, unknown>, opts: { where: Record<string, unknown> }) {
54+
assertEngineUpdateDispatch(data, opts);
55+
return { id: null };
56+
},
57+
async delete(_t: string, opts: { where: Record<string, unknown> }) {
58+
assertEngineDeleteDispatch(opts);
59+
return { deleted: 0 };
60+
},
5161
registry: { registerItem: () => {}, registerObject: () => {}, listItems: () => [] },
5262
} as any,
5363
};

0 commit comments

Comments
 (0)