@@ -2273,7 +2273,7 @@ describe('Note API', () => {
22732273 } ) ;
22742274 } ) ;
22752275
2276- describe ( 'GET /note/notehierarchy /:noteId' , ( ) => {
2276+ describe ( 'GET /note/note-hierarchy /:noteId' , ( ) => {
22772277 let accessToken = '' ;
22782278 let user : User ;
22792279
@@ -2297,13 +2297,14 @@ describe('Note API', () => {
22972297 headers : {
22982298 authorization : `Bearer ${ accessToken } ` ,
22992299 } ,
2300- url : `/note/notehierarchy /${ note . publicId } ` ,
2300+ url : `/note/note-hierarchy /${ note . publicId } ` ,
23012301 } ) ;
23022302
23032303 expect ( response ?. json ( ) . notehierarchy . id ) . toBe ( note . publicId ) ;
2304+ expect ( response ?. json ( ) . notehierarchy . childNotes ) . toHaveLength ( 0 ) ;
23042305 } ) ;
23052306
2306- test ( 'Get note hierarchy with parent or child' , async ( ) => {
2307+ test ( 'Get note hierarchy with child' , async ( ) => {
23072308 /* create test child note */
23082309 const childNote = await global . db . insertNote ( {
23092310 creatorId : user . id ,
@@ -2331,10 +2332,16 @@ describe('Note API', () => {
23312332 headers : {
23322333 authorization : `Bearer ${ accessToken } ` ,
23332334 } ,
2334- url : `/note/notehierarchy /${ parentNote . publicId } ` ,
2335+ url : `/note/note-hierarchy /${ parentNote . publicId } ` ,
23352336 } ) ;
23362337
2337- expect ( response ?. json ( ) . notehierarchy . childNotes [ 0 ] . id ) . toBe ( childNote . publicId ) ;
2338+ const childNoteObj = {
2339+ id : childNote . publicId ,
2340+ content : childNote . content ,
2341+ childNotes : [ ] ,
2342+ } ;
2343+
2344+ expect ( response ?. json ( ) . notehierarchy . childNotes [ 0 ] ) . toStrictEqual ( childNoteObj ) ;
23382345 } ) ;
23392346 } ) ;
23402347} ) ;
0 commit comments