1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00
This commit is contained in:
Dick Choi
2016-08-28 21:54:33 +09:00
parent 73dd0db529
commit 5163ab134e
4 changed files with 4 additions and 2 deletions

View File

@@ -59,6 +59,7 @@ function createNote (storageKey, input) {
while (!isUnique) { while (!isUnique) {
try { try {
sander.statSync(path.join(storage.path, 'notes', key + '.cson')) sander.statSync(path.join(storage.path, 'notes', key + '.cson'))
key = keygen()
} catch (err) { } catch (err) {
if (err.code === 'ENOENT') { if (err.code === 'ENOENT') {
isUnique = true isUnique = true

View File

@@ -41,6 +41,7 @@ function updateFolder (storageKey, folderKey, input) {
return resolveStorageData(targetStorage) return resolveStorageData(targetStorage)
.then(function updateFolder (storage) { .then(function updateFolder (storage) {
let targetFolder = _.find(storage.folders, {key: folderKey}) let targetFolder = _.find(storage.folders, {key: folderKey})
if (targetFolder == null) throw new Error('Target folder doesn\'t exist.')
targetFolder.name = input.name targetFolder.name = input.name
targetFolder.color = input.color targetFolder.color = input.color

View File

@@ -22,7 +22,7 @@ test.beforeEach((t) => {
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache])) localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
}) })
test.serial('Create a note', (t) => { test.serial('Delete a note', (t) => {
const storageKey = t.context.storage.cache.key const storageKey = t.context.storage.cache.key
const folderKey = t.context.storage.json.folders[0].key const folderKey = t.context.storage.json.folders[0].key

View File

@@ -22,7 +22,7 @@ test.beforeEach((t) => {
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache])) localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
}) })
test.serial('Create a note', (t) => { test.serial('Update a note', (t) => {
const storageKey = t.context.storage.cache.key const storageKey = t.context.storage.cache.key
const folderKey = t.context.storage.json.folders[0].key const folderKey = t.context.storage.json.folders[0].key