1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-20 13:11:44 +00:00

fixed eslint error & integrated with prettier as well as formatted the whole codebase (#3450)

This commit is contained in:
Nguyen Viet Hung
2020-02-05 13:28:27 +13:00
committed by GitHub
parent 051ce9e208
commit 592aca1539
186 changed files with 9233 additions and 5565 deletions

View File

@@ -6,7 +6,10 @@ global.window = document.defaultView
global.navigator = window.navigator
const Storage = require('dom-storage')
const localStorage = window.localStorage = global.localStorage = new Storage(null, { strict: true })
const localStorage = (window.localStorage = global.localStorage = new Storage(
null,
{ strict: true }
))
const path = require('path')
const TestDummy = require('../fixtures/TestDummy')
const sander = require('sander')
@@ -16,13 +19,16 @@ const CSON = require('@rokt33r/season')
const storagePath = path.join(os.tmpdir(), 'test/move-note')
const storagePath2 = path.join(os.tmpdir(), 'test/move-note2')
test.beforeEach((t) => {
test.beforeEach(t => {
t.context.storage1 = TestDummy.dummyStorage(storagePath)
t.context.storage2 = TestDummy.dummyStorage(storagePath2)
localStorage.setItem('storages', JSON.stringify([t.context.storage1.cache, t.context.storage2.cache]))
localStorage.setItem(
'storages',
JSON.stringify([t.context.storage1.cache, t.context.storage2.cache])
)
})
test.serial('Move a note', (t) => {
test.serial('Move a note', t => {
const storageKey1 = t.context.storage1.cache.key
const folderKey1 = t.context.storage1.json.folders[0].key
const note1 = t.context.storage1.notes[0]
@@ -31,22 +37,26 @@ test.serial('Move a note', (t) => {
const folderKey2 = t.context.storage2.json.folders[0].key
return Promise.resolve()
.then(function doTest () {
.then(function doTest() {
return Promise.all([
moveNote(storageKey1, note1.key, storageKey1, folderKey1),
moveNote(storageKey1, note2.key, storageKey2, folderKey2)
])
})
.then(function assert (data) {
.then(function assert(data) {
const data1 = data[0]
const data2 = data[1]
const jsonData1 = CSON.readFileSync(path.join(storagePath, 'notes', data1.key + '.cson'))
const jsonData1 = CSON.readFileSync(
path.join(storagePath, 'notes', data1.key + '.cson')
)
t.is(jsonData1.folder, folderKey1)
t.is(jsonData1.title, note1.title)
const jsonData2 = CSON.readFileSync(path.join(storagePath2, 'notes', data2.key + '.cson'))
const jsonData2 = CSON.readFileSync(
path.join(storagePath2, 'notes', data2.key + '.cson')
)
t.is(jsonData2.folder, folderKey2)
t.is(jsonData2.title, note2.title)
try {
@@ -58,7 +68,7 @@ test.serial('Move a note', (t) => {
})
})
test.after(function after () {
test.after(function after() {
localStorage.clear()
sander.rimrafSync(storagePath)
sander.rimrafSync(storagePath2)