Skip to content

Commit 25a8556

Browse files
committed
test(metadata-protocol): route the by-id double's findOne through the engine predicate, and pin it
Claude-Session: https://claude.ai/code/session_01FEkQ5kRR5RttkLiWWAkDA5 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 27848a9 commit 25a8556

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎packages/metadata-protocol/src/protocol.empty-projection-unknown-count.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
*/
4141

4242
import { describe, it, expect, vi } from 'vitest';
43+
import { assertEngineFindOnePredicate, type EngineFindOneQueryInput } from '@objectstack/metadata-core';
4344
import { ObjectStackProtocolImplementation } from './protocol.js';
4445

4546
const SCHEMA = {
@@ -53,7 +54,10 @@ const SCHEMA = {
5354

5455
function makeProtocol() {
5556
const find = vi.fn(async () => [{ id: 'r1', name: 'a', status: 'open' }] as unknown[]);
56-
const findOne = vi.fn(async () => ({ id: 'r1', name: 'a', status: 'open' }));
57+
const findOne = vi.fn(async (object: string, query?: EngineFindOneQueryInput) => {
58+
assertEngineFindOnePredicate(object, query);
59+
return { id: 'r1', name: 'a', status: 'open' };
60+
});
5761
const count = vi.fn(async () => 7);
5862
const engine = {
5963
registry: { getObject: (n: string) => (n === 'invoice' ? SCHEMA : undefined) },

‎scripts/engine-double-contract.pinned.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,11 @@
781781
"verb": "update",
782782
"pinned": 3
783783
},
784+
{
785+
"file": "packages/metadata-protocol/src/protocol.empty-projection-unknown-count.test.ts",
786+
"verb": "findOne",
787+
"pinned": 2
788+
},
784789
{
785790
"file": "packages/metadata-protocol/src/protocol.expand-target-exposure.test.ts",
786791
"verb": "findOne",

0 commit comments

Comments
 (0)