|
34 | 34 | * the two comparand arms it names no operator, so `field` is its subject. |
35 | 35 | * objectui#11094 added the `$empty` flag refusal (a flag that is not a |
36 | 36 | * 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. |
37 | 40 | * |
38 | 41 | * ⚠️ Each input is driven through `toFilterNodeSafely` — the RENDER-time entry, |
39 | 42 | * not `convertFiltersToAST` directly — because the question is what a renderer |
|
43 | 46 |
|
44 | 47 | import { describe, it, expect } from 'vitest'; |
45 | 48 | import { readFileSync } from 'node:fs'; |
| 49 | +import { runInNewContext } from 'node:vm'; |
46 | 50 | import { fileURLToPath } from 'node:url'; |
47 | 51 | import { dirname, join } from 'node:path'; |
48 | 52 | import { |
@@ -70,6 +74,7 @@ const REFUSALS: Array<{ |
70 | 74 | { site: 'combinator value is not an array', input: { $and: 'nope' }, operator: '$and', field: undefined, subject: '$and' }, |
71 | 75 | { site: 'combinator member is not an object', input: { $and: ['nope'] }, operator: '$and', field: undefined, subject: '$and' }, |
72 | 76 | { 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' }, |
73 | 78 | { site: 'empty operator map with no other condition', input: { a: {} }, operator: undefined, field: 'a', subject: 'a' }, |
74 | 79 | { site: '$not combinator', input: { $not: { a: 1 } }, operator: '$not', field: undefined, subject: '$not' }, |
75 | 80 | { site: 'bare array equality comparand', input: { tags: ['a', 'b'] }, operator: undefined, field: 'tags', subject: 'tags' }, |
|
0 commit comments