Skip to content

Commit

Permalink
tests: add type evaluator tests for array::intersects
Browse files Browse the repository at this point in the history
  • Loading branch information
j33ty committed Aug 22, 2024
1 parent 8059479 commit ebefe09
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/typeEvaluate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2670,6 +2670,36 @@ t.test('function: array::unique', (t) => {
t.end()
})

t.test('function: array::intersects', (t) => {
const query = `* {
"f1": array::intersects(true, true),
"f2": array::intersects([1, 2, true], [5, 1, false]),
}`
const ast = parse(query)
const res = typeEvaluate(ast, schemas)
t.strictSame(res, {
type: 'array',
of: {
type: 'object',
attributes: {
f1: {
type: 'objectAttribute',
value: {
type: 'null',
},
},
f2: {
type: 'objectAttribute',
value: {
type: 'boolean',
},
},
},
},
})
t.end()
})

t.test('function: math::*', (t) => {
const query = `*[_type == "author"] {
"ages": math::min(ages),
Expand Down

0 comments on commit ebefe09

Please sign in to comment.