File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,28 @@ describe("select", () => {
500
500
) ;
501
501
} ) ;
502
502
503
+ test ( "named tuples" , async ( ) => {
504
+ const namedTuple = e . tuple ( { foo : e . str ( "bar" ) } ) ;
505
+ const result = await e . select ( namedTuple ) . run ( client ) ;
506
+ assert . deepEqual ( result , { foo : "bar" } ) ;
507
+
508
+ const pathResult = await e . select ( namedTuple . foo ) . run ( client ) ;
509
+ assert . deepEqual ( pathResult , "bar" ) ;
510
+
511
+ const nestedObjectTuple = e . for ( e . select ( e . Hero ) , ( hero ) =>
512
+ e . tuple ( {
513
+ hero,
514
+ score : e . random ( ) ,
515
+ } )
516
+ ) ;
517
+ const nestedObjectQuery = e . select ( nestedObjectTuple . hero , ( hero ) => ( {
518
+ name : hero . name ,
519
+ order_by : nestedObjectTuple . score ,
520
+ } ) ) ;
521
+ const nestedObjectResult = await nestedObjectQuery . run ( client ) ;
522
+ assert . deepEqual ( nestedObjectResult , [ ] ) ;
523
+ } ) ;
524
+
503
525
test ( "filter by id" , async ( ) => {
504
526
const result = await e
505
527
. select ( e . Hero , ( ) => ( {
You can’t perform that action at this time.
0 commit comments