File tree Expand file tree Collapse file tree
src/presentation/http/router Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2072,4 +2072,46 @@ describe('Note API', () => {
20722072 }
20732073 } ) ;
20742074 } ) ;
2075+
2076+ describe ( 'DELETE /note/:noteId' , ( ) => {
2077+ test ( 'Delete note history on note deletion' , async ( ) => {
2078+ /**
2079+ * Insert test user
2080+ */
2081+ const user = await global . db . insertUser ( ) ;
2082+
2083+ /**
2084+ * Authorization for user
2085+ */
2086+ const accessToken = global . auth ( user . id ) ;
2087+
2088+ /**
2089+ * Insert test note, note history record will be inserted automatically
2090+ */
2091+ const note = await global . db . insertNote ( {
2092+ creatorId : user . id ,
2093+ } ) ;
2094+
2095+ /**
2096+ * Delete note
2097+ */
2098+ await global . api ?. fakeRequest ( {
2099+ method : 'DELETE' ,
2100+ headers : {
2101+ authorization : `Bearer ${ accessToken } ` ,
2102+ } ,
2103+ url : `/note/${ note . publicId } ` ,
2104+ } ) ;
2105+
2106+ const response = await global . api ?. fakeRequest ( {
2107+ method : 'GET' ,
2108+ headers : {
2109+ authorization : `Bearer ${ accessToken } ` ,
2110+ } ,
2111+ url : `/note/${ note . publicId } /history` ,
2112+ } ) ;
2113+
2114+ expect ( response ?. json ( ) . message ) . toBe ( 'Note not found' ) ;
2115+ } ) ;
2116+ } ) ;
20752117} ) ;
You can’t perform that action at this time.
0 commit comments