Skip to content

Commit 2dd91cd

Browse files
committed
test(core): enumerate the foreign-realm refusal among the converter's throw sites
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvVRcFWKrfWeG5jzPb
1 parent 7c1dd7f commit 2dd91cd

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎ui/packages/core/src/utils/__tests__/filter-refusal-subject-9050.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
* the two comparand arms it names no operator, so `field` is its subject.
3535
* objectui#11094 added the `$empty` flag refusal (a flag that is not a
3636
* boolean) the same way; it names its operator, so `$empty` is its subject.
37+
* objectstack#35533 added the foreign-realm refusal (a field's whole condition
38+
* is a plain object of another realm); it names no operator, so `field` is its
39+
* subject.
3740
*
3841
* ⚠️ Each input is driven through `toFilterNodeSafely` — the RENDER-time entry,
3942
* not `convertFiltersToAST` directly — because the question is what a renderer
@@ -43,6 +46,7 @@
4346

4447
import { describe, it, expect } from 'vitest';
4548
import { readFileSync } from 'node:fs';
49+
import { runInNewContext } from 'node:vm';
4650
import { fileURLToPath } from 'node:url';
4751
import { dirname, join } from 'node:path';
4852
import {
@@ -70,6 +74,7 @@ const REFUSALS: Array<{
7074
{ site: 'combinator value is not an array', input: { $and: 'nope' }, operator: '$and', field: undefined, subject: '$and' },
7175
{ site: 'combinator member is not an object', input: { $and: ['nope'] }, operator: '$and', field: undefined, subject: '$and' },
7276
{ site: '$icontains comparand', input: { name: { $icontains: '' } }, operator: '$icontains', field: 'name', subject: '$icontains' },
77+
{ site: 'plain object from another realm', input: { age: runInNewContext('({ $gte: 18 })') }, operator: undefined, field: 'age', subject: 'age' },
7378
{ site: 'empty operator map with no other condition', input: { a: {} }, operator: undefined, field: 'a', subject: 'a' },
7479
{ site: '$not combinator', input: { $not: { a: 1 } }, operator: '$not', field: undefined, subject: '$not' },
7580
{ site: 'bare array equality comparand', input: { tags: ['a', 'b'] }, operator: undefined, field: 'tags', subject: 'tags' },

0 commit comments

Comments
 (0)