Skip to content

Commit 092b2cc

Browse files
committed
test(plugin-sharing): the grant-store double applies the caller's limit
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2f62c1GYk6XzbdtCa4
1 parent fb78dd2 commit 092b2cc

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/plugins/plugin-sharing/src/shareable-objects.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ function grantStore() {
267267
});
268268
};
269269
const store = {
270-
find: async (object: string, opts?: { where?: unknown; filter?: unknown }) =>
271-
(rows[object] ?? []).filter((r) => matches(r, opts?.where ?? opts?.filter)),
270+
find: async (object: string, opts?: { where?: unknown; filter?: unknown; limit?: number }) => {
271+
const matched = (rows[object] ?? []).filter((r) => matches(r, opts?.where ?? opts?.filter));
272+
return typeof opts?.limit === 'number' ? matched.slice(0, opts.limit) : matched;
273+
},
272274
findOne: async (object: string, opts?: { where?: unknown; filter?: unknown }) =>
273275
(rows[object] ?? []).find((r) => matches(r, opts?.where ?? opts?.filter)) ?? null,
274276
};

0 commit comments

Comments
 (0)