@@ -16,16 +16,27 @@ Deno.test('test expression functions', async (t) => {
1616 } )
1717 await t . step ( 'intersects function' , ( ) => {
1818 const intersects = expressionFunctions . intersects
19- assert ( intersects ( [ 1 , 2 , 3 ] , [ 2 , 3 , 4 ] ) === true )
19+ const equal = expressionFunctions . allequal
20+
21+ const truthy = ( a : any ) : boolean => ! ! a
22+
23+ assert ( truthy ( intersects ( [ 1 , 2 , 3 ] , [ 2 , 3 , 4 ] ) ) )
2024 assert ( intersects ( [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ) === false )
21- assert ( intersects ( [ 'abc' , 'def' ] , [ 'def' ] ) === true )
25+ assert ( truthy ( intersects ( [ 'abc' , 'def' ] , [ 'def' ] ) ) )
2226 assert ( intersects ( [ 'abc' , 'def' ] , [ 'ghi' ] ) === false )
27+ // Just checking values, I'm not concerned about types here
28+ // @ts -expect-error
29+ assert ( equal ( intersects ( [ 1 , 2 , 3 ] , [ 2 , 3 , 4 ] ) , [ 2 , 3 ] ) )
30+ // @ts -expect-error
31+ assert ( equal ( intersects ( [ 'abc' , 'def' ] , [ 'def' ] ) , [ 'def' ] ) )
2332
2433 // Promote scalars to arrays
2534 // @ts -ignore
26- assert ( intersects ( 'abc' , [ 'abc' , 'def' ] ) === true )
35+ assert ( truthy ( intersects ( 'abc' , [ 'abc' , 'def' ] ) ) )
2736 // @ts -ignore
2837 assert ( intersects ( 'abc' , [ 'a' , 'b' , 'c' ] ) === false )
38+ // @ts -expect-error
39+ assert ( equal ( intersects ( 'abc' , [ 'abc' , 'def' ] ) , [ 'abc' ] ) )
2940 } )
3041 await t . step ( 'match function' , ( ) => {
3142 const match = expressionFunctions . match
0 commit comments