@@ -16,16 +16,26 @@ 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 )
20- assert ( intersects ( [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ) === false )
21- assert ( intersects ( [ 'abc' , 'def' ] , [ 'def' ] ) === true )
22- assert ( intersects ( [ 'abc' , 'def' ] , [ 'ghi' ] ) === false )
19+ const truthy = ( a : any ) : boolean => ! ! a
20+ const falsey = ( a : any ) : boolean => ! a
21+ const equal = expressionFunctions . allequal
22+ assert ( truthy ( intersects ( [ 1 , 2 , 3 ] , [ 2 , 3 , 4 ] ) ) )
23+ assert ( falsey ( intersects ( [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ) ) )
24+ assert ( truthy ( intersects ( [ 'abc' , 'def' ] , [ 'def' ] ) ) )
25+ assert ( falsey ( intersects ( [ 'abc' , 'def' ] , [ 'ghi' ] ) ) )
26+ // Just checking values, I'm not concerned about types here
27+ // @ts -expect-error
28+ assert ( equal ( intersects ( [ 1 , 2 , 3 ] , [ 2 , 3 , 4 ] ) , [ 2 , 3 ] ) )
29+ // @ts -expect-error
30+ assert ( equal ( intersects ( [ 'abc' , 'def' ] , [ 'def' ] ) , [ 'def' ] ) )
2331
2432 // Promote scalars to arrays
2533 // @ts -ignore
26- assert ( intersects ( 'abc' , [ 'abc' , 'def' ] ) === true )
34+ assert ( truthy ( intersects ( 'abc' , [ 'abc' , 'def' ] ) ) )
2735 // @ts -ignore
28- assert ( intersects ( 'abc' , [ 'a' , 'b' , 'c' ] ) === false )
36+ assert ( falsey ( intersects ( 'abc' , [ 'a' , 'b' , 'c' ] ) ) )
37+ // @ts -expect-error
38+ assert ( equal ( intersects ( 'abc' , [ 'abc' , 'def' ] ) , [ 'abc' ] ) )
2939 } )
3040 await t . step ( 'match function' , ( ) => {
3141 const match = expressionFunctions . match
0 commit comments