@@ -568,65 +568,65 @@ describe('Note API', () => {
568568 } ) ;
569569 } ) ;
570570
571- test ( 'Returns two note parents in case when note has two parents ' , async ( ) => {
571+ test ( 'Returns two note parents in case when the note parents IDs relations are provided in a different order than expected ' , async ( ) => {
572572 /** Create test user */
573573 const user = await global . db . insertUser ( ) ;
574574
575575 /** Create access token for the user */
576576 const accessToken = global . auth ( user . id ) ;
577577
578578 /** Create test note - a grand parent note */
579- const grandParentNote = await global . db . insertNote ( {
579+ const firstNote = await global . db . insertNote ( {
580580 creatorId : user . id ,
581581 } ) ;
582582
583583 /** Create test note - a parent note */
584- const parentNote = await global . db . insertNote ( {
584+ const secondNote = await global . db . insertNote ( {
585585 creatorId : user . id ,
586586 } ) ;
587587
588588 /** Create test note - a child note */
589- const childNote = await global . db . insertNote ( {
589+ const thirdNote = await global . db . insertNote ( {
590590 creatorId : user . id ,
591591 } ) ;
592592
593593 /** Create test note settings */
594594 await global . db . insertNoteSetting ( {
595- noteId : childNote . id ,
595+ noteId : secondNote . id ,
596596 isPublic : true ,
597597 } ) ;
598598
599599 /** Create note relation between parent and grandParentNote */
600600 await global . db . insertNoteRelation ( {
601- parentId : grandParentNote . id ,
602- noteId : parentNote . id ,
601+ parentId : firstNote . id ,
602+ noteId : thirdNote . id ,
603603 } ) ;
604604
605605 /** Create test note relation */
606606 await global . db . insertNoteRelation ( {
607- parentId : parentNote . id ,
608- noteId : childNote . id ,
607+ parentId : thirdNote . id ,
608+ noteId : secondNote . id ,
609609 } ) ;
610610
611611 const response = await global . api ?. fakeRequest ( {
612612 method : 'GET' ,
613613 headers : {
614614 authorization : `Bearer ${ accessToken } ` ,
615615 } ,
616- url : `/note/${ childNote . publicId } ` ,
616+ url : `/note/${ secondNote . publicId } ` ,
617617 } ) ;
618618
619619 expect ( response ?. statusCode ) . toBe ( 200 ) ;
620620
621621 expect ( response ?. json ( ) ) . toMatchObject ( {
622622 parents : [
623623 {
624- id : grandParentNote . publicId ,
625- content : grandParentNote . content ,
624+ id : firstNote . publicId ,
625+ content : firstNote . content ,
626626 } ,
627627 {
628- id : parentNote . publicId ,
629- content : parentNote . content ,
628+ id : thirdNote . publicId ,
629+ content : thirdNote . content ,
630630 } ,
631631 ] ,
632632 } ) ;
@@ -684,7 +684,7 @@ describe('Note API', () => {
684684 } ) ;
685685 } ) ;
686686
687- test ( 'Returns empty array in case where there is no relation exist for the note with status 200 ' , async ( ) => {
687+ test ( 'Returns empty array in case where there is no relation exist for the note' , async ( ) => {
688688 /** Create test user */
689689 const user = await global . db . insertUser ( ) ;
690690
0 commit comments