@@ -45,7 +45,8 @@ test.serial('Delete a note', (t) => {
45
45
. then ( function doTest ( ) {
46
46
return createNote ( storageKey , input1 )
47
47
. then ( function createAttachmentFolder ( data ) {
48
- fs . mkdirSync ( path . join ( storagePath . path , attachmentManagement . DESTINATION_FOLDER , data . noteKey ) )
48
+ fs . mkdirSync ( path . join ( storagePath , attachmentManagement . DESTINATION_FOLDER ) )
49
+ fs . mkdirSync ( path . join ( storagePath , attachmentManagement . DESTINATION_FOLDER , data . key ) )
49
50
return data
50
51
} )
51
52
. then ( function ( data ) {
@@ -54,15 +55,16 @@ test.serial('Delete a note', (t) => {
54
55
} )
55
56
. then ( function assert ( data ) {
56
57
try {
57
- CSON . readFileSync ( path . join ( storagePath . path , 'notes' , data . noteKey + '.cson' ) )
58
+ CSON . readFileSync ( path . join ( storagePath , 'notes' , data . noteKey + '.cson' ) )
58
59
t . fail ( 'note cson must be deleted.' )
59
60
} catch ( err ) {
60
61
t . is ( err . code , 'ENOENT' )
62
+ return data
61
63
}
62
64
} )
63
65
. then ( function assertAttachmentFolderDeleted ( data ) {
64
- const attachmentFolderPath = path . join ( storagePath . path , attachmentManagement . DESTINATION_FOLDER , data . noteKey )
65
- t . assert ( fs . existsSync ( attachmentFolderPath ) === false , 'Attachment folder was not deleted' )
66
+ const attachmentFolderPath = path . join ( storagePath , attachmentManagement . DESTINATION_FOLDER , data . noteKey )
67
+ t . is ( fs . existsSync ( attachmentFolderPath ) , false )
66
68
} )
67
69
} )
68
70
0 commit comments