@@ -341,49 +341,57 @@ describe('Testing of the collection.data methods with a single target reference'
341341
342342  it ( 'should be able to delete a reference between two objects' ,  ( )  =>  { 
343343    // Insert 2 objects 
344-     return  collection . data . insertMany ( [ 
345-       {  testProp : "refLeft"  } ,  {  testProp : "refRight"  } , 
346-     ] ) 
347-       // Create a reference between them 
348-       . then ( inserted  =>  collection . data . referenceAdd ( { 
349-         fromProperty : 'ref' , 
350-         fromUuid : inserted . allResponses [ 0 ]  as  string , 
351-         to : inserted . allResponses [ 1 ]  as  string , 
352-       } ) . then ( ( )  =>  inserted ) ) 
344+     return  ( 
345+       collection . data 
346+         . insertMany ( [ {  testProp : 'refLeft'  } ,  {  testProp : 'refRight'  } ] ) 
347+         // Create a reference between them 
348+         . then ( ( inserted )  => 
349+           collection . data 
350+             . referenceAdd ( { 
351+               fromProperty : 'ref' , 
352+               fromUuid : inserted . allResponses [ 0 ]  as  string , 
353+               to : inserted . allResponses [ 1 ]  as  string , 
354+             } ) 
355+             . then ( ( )  =>  inserted ) 
356+         ) 
353357
354-       // Assert that the reference exists 
355-       . then ( inserted  => 
356-         collection . query . fetchObjectById ( inserted . allResponses [ 0 ]  as  string ,  { 
357-           returnReferences : [ {  linkOn : 'ref'  } ] , 
358-         } ) 
359-           . then ( ( obj )  =>  { 
360-             expect ( obj ) . not . toBeNull ( ) ; 
361-             expect ( obj ?. references ?. ref ?. objects ) . toHaveLength ( 1 ) ; 
358+         // Assert that the reference exists 
359+         . then ( ( inserted )  => 
360+           collection . query 
361+             . fetchObjectById ( inserted . allResponses [ 0 ]  as  string ,  { 
362+               returnReferences : [ {  linkOn : 'ref'  } ] , 
363+             } ) 
364+             . then ( ( obj )  =>  { 
365+               expect ( obj ) . not . toBeNull ( ) ; 
366+               expect ( obj ?. references ?. ref ?. objects ) . toHaveLength ( 1 ) ; 
362367
363-             // Propagate the list of inserted IDs 
364-             return  Promise . resolve ( inserted ) ; 
365-           } ) 
366-       ) 
368+                // Propagate the list of inserted IDs 
369+                return  Promise . resolve ( inserted ) ; 
370+              } ) 
371+          ) 
367372
368-       // Delete reference between them 
369-       . then ( inserted  => 
370-         collection . data . referenceDelete ( { 
371-           fromProperty : 'ref' , 
372-           fromUuid : inserted . allResponses [ 0 ]  as  string , 
373-           to : inserted . allResponses [ 1 ]  as  string , 
374-         } ) 
375-           . then ( ( )  =>  inserted ) ) 
373+         // Delete reference between them 
374+         . then ( ( inserted )  => 
375+           collection . data 
376+             . referenceDelete ( { 
377+               fromProperty : 'ref' , 
378+               fromUuid : inserted . allResponses [ 0 ]  as  string , 
379+               to : inserted . allResponses [ 1 ]  as  string , 
380+             } ) 
381+             . then ( ( )  =>  inserted ) 
382+         ) 
376383
377-       // Assert the reference does not exist 
378-       . then ( inserted  => 
379-         collection . query . fetchObjectById ( inserted . allResponses [ 0 ]  as  string ,  { 
380-           returnReferences : [ {  linkOn : 'ref'  } ] , 
384+         // Assert the reference does not exist 
385+         . then ( ( inserted )  => 
386+           collection . query . fetchObjectById ( inserted . allResponses [ 0 ]  as  string ,  { 
387+             returnReferences : [ {  linkOn : 'ref'  } ] , 
388+           } ) 
389+         ) 
390+         . then ( ( obj )  =>  { 
391+           expect ( obj ) . not . toBeNull ( ) ; 
392+           expect ( obj ?. references ?. ref ?. objects ) . toEqual ( [ ] ) ; 
381393        } ) 
382-       ) 
383-       . then ( ( obj )  =>  { 
384-         expect ( obj ) . not . toBeNull ( ) ; 
385-         expect ( obj ?. references ?. ref ?. objects ) . toEqual ( [ ] ) ; 
386-       } ) ; 
394+     ) ; 
387395  } ) ; 
388396
389397  it ( 'should be able to add many references in batch' ,  ( )  =>  { 
0 commit comments