mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
fix type
stoargeKey -> storageKey
This commit is contained in:
@@ -24,7 +24,7 @@ test.beforeEach((t) => {
|
||||
localStorage.setItem('storages', JSON.stringify([]))
|
||||
})
|
||||
|
||||
test.serial('add a initialized storage', (t) => {
|
||||
test.serial('Add Storage', (t) => {
|
||||
const input = {
|
||||
type: 'FILESYSTEM',
|
||||
name: 'add-storage1',
|
||||
|
||||
@@ -22,14 +22,14 @@ test.beforeEach((t) => {
|
||||
})
|
||||
|
||||
test.serial('Create a folder', (t) => {
|
||||
const stoargeKey = t.context.storage.cache.key
|
||||
const storageKey = t.context.storage.cache.key
|
||||
const input = {
|
||||
name: 'created',
|
||||
color: '#ff5555'
|
||||
}
|
||||
return Promise.resolve()
|
||||
.then(function doTest () {
|
||||
return createFolder(stoargeKey, input)
|
||||
return createFolder(storageKey, input)
|
||||
})
|
||||
.then(function assert (data) {
|
||||
t.true(_.find(data.storage.folders, input) != null)
|
||||
|
||||
@@ -8,7 +8,6 @@ global.navigator = window.navigator
|
||||
const Storage = require('dom-storage')
|
||||
const localStorage = window.localStorage = global.localStorage = new Storage(null, { strict: true })
|
||||
const path = require('path')
|
||||
const _ = require('lodash')
|
||||
const TestDummy = require('../fixtures/TestDummy')
|
||||
const sander = require('sander')
|
||||
const os = require('os')
|
||||
@@ -23,7 +22,7 @@ test.beforeEach((t) => {
|
||||
})
|
||||
|
||||
test.serial('Create a note', (t) => {
|
||||
const stoargeKey = t.context.storage.cache.key
|
||||
const storageKey = t.context.storage.cache.key
|
||||
const folderKey = t.context.storage.json.folders[0].key
|
||||
|
||||
const input1 = {
|
||||
@@ -50,14 +49,15 @@ test.serial('Create a note', (t) => {
|
||||
return Promise.resolve()
|
||||
.then(function doTest () {
|
||||
return Promise.all([
|
||||
createNote(stoargeKey, input1),
|
||||
createNote(stoargeKey, input2)
|
||||
createNote(storageKey, input1),
|
||||
createNote(storageKey, input2)
|
||||
])
|
||||
})
|
||||
.then(function assert (data) {
|
||||
let data1 = data[0]
|
||||
let data2 = data[1]
|
||||
|
||||
t.is(storageKey, data1.storage)
|
||||
let jsonData1 = CSON.readFileSync(path.join(storagePath, 'notes', data1.key + '.cson'))
|
||||
t.is(input1.title, data1.title)
|
||||
t.is(input1.title, jsonData1.title)
|
||||
@@ -72,6 +72,7 @@ test.serial('Create a note', (t) => {
|
||||
t.is(input1.snippets[0].name, data1.snippets[0].name)
|
||||
t.is(input1.snippets[0].name, jsonData1.snippets[0].name)
|
||||
|
||||
t.is(storageKey, data2.storage)
|
||||
let jsonData2 = CSON.readFileSync(path.join(storagePath, 'notes', data2.key + '.cson'))
|
||||
t.is(input2.title, data2.title)
|
||||
t.is(input2.title, jsonData2.title)
|
||||
|
||||
@@ -21,13 +21,13 @@ test.beforeEach((t) => {
|
||||
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
|
||||
})
|
||||
|
||||
test.serial('Create a folder', (t) => {
|
||||
const stoargeKey = t.context.storage.cache.key
|
||||
test.serial('Delete a folder', (t) => {
|
||||
const storageKey = t.context.storage.cache.key
|
||||
const folderKey = t.context.storage.json.folders[0].key
|
||||
|
||||
return Promise.resolve()
|
||||
.then(function doTest () {
|
||||
return deleteFolder(stoargeKey, folderKey)
|
||||
return deleteFolder(storageKey, folderKey)
|
||||
})
|
||||
.then(function assert (data) {
|
||||
t.true(_.find(data.storage.folders, {key: folderKey}) == null)
|
||||
|
||||
@@ -35,7 +35,7 @@ test.beforeEach((t) => {
|
||||
localStorage.setItem('storages', JSON.stringify([t.context.v1StorageData.cache, t.context.legacyStorageData.cache, t.context.emptyStorageData.cache]))
|
||||
})
|
||||
|
||||
test.serial('Fetch storages and notes', (t) => {
|
||||
test.serial('Initialize All Storages', (t) => {
|
||||
const { v1StorageData, legacyStorageData, emptyStorageData } = t.context
|
||||
return Promise.resolve()
|
||||
.then(function test () {
|
||||
|
||||
@@ -20,10 +20,10 @@ test.beforeEach((t) => {
|
||||
})
|
||||
|
||||
test('Remove a storage', (t) => {
|
||||
const stoargeKey = t.context.storage.cache.key
|
||||
const storageKey = t.context.storage.cache.key
|
||||
return Promise.resolve()
|
||||
.then(function doTest () {
|
||||
return removeStorage(stoargeKey)
|
||||
return removeStorage(storageKey)
|
||||
})
|
||||
.then(function assert (data) {
|
||||
t.is(JSON.parse(localStorage.getItem('storages')).length, 0)
|
||||
|
||||
@@ -21,14 +21,14 @@ test.beforeEach((t) => {
|
||||
})
|
||||
|
||||
test.serial('Rename a storage', (t) => {
|
||||
const stoargeKey = t.context.storage.cache.key
|
||||
const storageKey = t.context.storage.cache.key
|
||||
return Promise.resolve()
|
||||
.then(function doTest () {
|
||||
return renameStorage(stoargeKey, 'changed')
|
||||
return renameStorage(storageKey, 'changed')
|
||||
})
|
||||
.then(function assert (data) {
|
||||
let cachedStorageList = JSON.parse(localStorage.getItem('storages'))
|
||||
t.true(_.find(cachedStorageList, {key: stoargeKey}).name === 'changed')
|
||||
t.true(_.find(cachedStorageList, {key: storageKey}).name === 'changed')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ test.beforeEach((t) => {
|
||||
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
|
||||
})
|
||||
|
||||
test.serial('Create a folder', (t) => {
|
||||
const stoargeKey = t.context.storage.cache.key
|
||||
test.serial('Update a folder', (t) => {
|
||||
const storageKey = t.context.storage.cache.key
|
||||
const folderKey = t.context.storage.json.folders[0].key
|
||||
const input = {
|
||||
name: 'changed',
|
||||
@@ -30,7 +30,7 @@ test.serial('Create a folder', (t) => {
|
||||
}
|
||||
return Promise.resolve()
|
||||
.then(function doTest () {
|
||||
return updateFolder(stoargeKey, folderKey, input)
|
||||
return updateFolder(storageKey, folderKey, input)
|
||||
})
|
||||
.then(function assert (data) {
|
||||
t.true(_.find(data.storage.folders, input) != null)
|
||||
|
||||
Reference in New Issue
Block a user