Skip to content

Commit 8d4b004

Browse files
committed
test(rest): the real-protocol form harness doubles only the engine reads the route reaches
The route's protocol reads touch the registry and the sys_metadata list read; the double no longer carries a findOne it never answers. Claude-Session: https://claude.ai/code/session_018t6a5rvqPRvEDMCVVW9kYT Co-authored-by: Claude <noreply@anthropic.com>
1 parent b4e56cf commit 8d4b004

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

‎packages/rest/src/public-form-section-i18n.test.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
// answers when it is handed a form in those slots anyway.
2727

2828
import { describe, it, expect, vi } from 'vitest';
29-
import { assertEngineFindOnePredicate } from '@objectstack/metadata-core';
3029
import { ObjectStackProtocolImplementation } from '@objectstack/metadata-protocol';
3130
import { SchemaRegistry } from '@objectstack/objectql';
3231
import { expandViewContainer } from '@objectstack/spec/ui';
@@ -271,14 +270,10 @@ function realProtocolSession() {
271270
const registry = new SchemaRegistry({ multiTenant: false });
272271
registry.logLevel = 'silent';
273272
const rows: Record<string, unknown>[] = [];
273+
// Only what the route's reads reach: the registry and the `sys_metadata`
274+
// list read the protocol's view list overlays rows from.
274275
const engine: any = {
275276
registry,
276-
async findOne(table: string, o: { where: Record<string, unknown> }) {
277-
// The real engine's predicate: a `findOne` naming no record is refused.
278-
assertEngineFindOnePredicate(table, o);
279-
if (table !== 'sys_metadata') return null;
280-
return rows.find((r) => matchesWhere(r, o.where)) ?? null;
281-
},
282277
async find(table: string, o: { where: Record<string, unknown>; limit?: number }) {
283278
if (table !== 'sys_metadata') return [];
284279
const matched = rows.filter((r) => matchesWhere(r, o.where));

0 commit comments

Comments
 (0)