From ba374e08ff080e2b6b3dcefb6c9a89beb053c033 Mon Sep 17 00:00:00 2001 From: Dick Choi Date: Tue, 30 Aug 2016 02:33:00 +0900 Subject: [PATCH] fix moveNote Api --- browser/main/lib/dataApi/moveNote.js | 8 +++----- tests/dataApi/moveNote.js | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/browser/main/lib/dataApi/moveNote.js b/browser/main/lib/dataApi/moveNote.js index 2c938aad..1564d80c 100644 --- a/browser/main/lib/dataApi/moveNote.js +++ b/browser/main/lib/dataApi/moveNote.js @@ -65,15 +65,13 @@ function moveNote (storageKey, noteKey, newStorageKey, newFolderKey) { noteData.folder = newFolderKey noteData.key = newNoteKey noteData.storage = newStorageKey + noteData.updatedAt = new Date() + return noteData }) .then(function writeAndReturn (noteData) { CSON.writeFileSync(path.join(newStorage.path, 'notes', noteData.key + '.cson'), _.omit(noteData, ['key', 'storage'])) - return { - oldStorageKey: storageKey, - oldNoteKey: noteKey, - note: noteData - } + return noteData }) .then(function deleteOldNote (data) { if (storageKey !== newStorageKey) { diff --git a/tests/dataApi/moveNote.js b/tests/dataApi/moveNote.js index 2f9fccd1..595b46ed 100644 --- a/tests/dataApi/moveNote.js +++ b/tests/dataApi/moveNote.js @@ -42,12 +42,12 @@ test.serial('Move a note', (t) => { let data1 = data[0] let data2 = data[1] - let jsonData1 = CSON.readFileSync(path.join(storagePath, 'notes', data1.note.key + '.cson')) + let jsonData1 = CSON.readFileSync(path.join(storagePath, 'notes', data1.key + '.cson')) t.is(jsonData1.folder, folderKey1) t.is(jsonData1.title, note1.title) - let jsonData2 = CSON.readFileSync(path.join(storagePath2, 'notes', data2.note.key + '.cson')) + let jsonData2 = CSON.readFileSync(path.join(storagePath2, 'notes', data2.key + '.cson')) t.is(jsonData2.folder, folderKey2) t.is(jsonData2.title, note2.title) try {