Skip to content

Commit 9b235f2

Browse files
committed
test(rest): type the deliberately off-contract query options in the flag-comparand cell
Claude-Session: https://claude.ai/code/session_01Ujdtvqs7ree7WyQmEDwEnG Co-authored-by: Claude <noreply@anthropic.com>
1 parent a876bc2 commit 9b235f2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎packages/rest/src/aggregation-flag-comparand-refusal.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
*/
5151

5252
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
53+
import type { EngineAggregateOptions, EngineQueryOptions } from '@objectstack/spec/data';
5354
import { ObjectQL } from '@objectstack/objectql';
5455
import { SqlDriver, withheldFilterDiagnosticOf } from '@objectstack/driver-sql';
5556
import { ObjectStackProtocolImplementation } from '@objectstack/metadata-protocol';
@@ -139,7 +140,8 @@ describe('[#20981] a non-boolean $exists / $null in a per-aggregation filter or
139140
/** The `where` twin's refusal, thrown by `driver-sql`, and the diagnostic it keeps server-side. */
140141
async function whereTwinDiagnostic(op: string, comparand: unknown): Promise<string> {
141142
try {
142-
await engine.find(OBJECT, { where: { name: { [op]: comparand } } } as any);
143+
// Deliberately off-contract: the flag is not a boolean.
144+
await engine.find(OBJECT, { where: { name: { [op]: comparand } } } as unknown as EngineQueryOptions);
143145
} catch (err) {
144146
expect((err as { code?: string }).code).toBe('INVALID_FILTER');
145147
const diagnostic = withheldFilterDiagnosticOf(err);
@@ -152,7 +154,8 @@ describe('[#20981] a non-boolean $exists / $null in a per-aggregation filter or
152154
/** The engine's full message, thrown before any row is read. */
153155
async function engineRefusal(body: Record<string, unknown>): Promise<Error & { code?: string; status?: number }> {
154156
try {
155-
await engine.aggregate(OBJECT, body as any);
157+
// Deliberately off-contract: the flag is not a boolean.
158+
await engine.aggregate(OBJECT, body as unknown as EngineAggregateOptions);
156159
} catch (err) {
157160
return err as Error & { code?: string; status?: number };
158161
}

0 commit comments

Comments
 (0)