1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

fix how handle the storage as context data

This commit is contained in:
amedora
2019-08-07 14:52:17 +09:00
parent 404dddcb86
commit e4e10d523f

View File

@@ -12,14 +12,16 @@ const sander = require('sander')
const os = require('os')
const storagePath = path.join(os.tmpdir(), 'test/find-storage')
let storageContext
beforeEach(() => {
t.context.storage = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
storageContext = TestDummy.dummyStorage(storagePath)
localStorage.setItem('storages', JSON.stringify([storageContext.cache]))
})
// Unit test
test('findStorage() should return a correct storage path(string)', () => {
const storageKey = t.context.storage.cache.key
const storageKey = storageContext.cache.key
expect(findStorage(storageKey).key).toBe(storageKey)
expect(findStorage(storageKey).path).toBe(storagePath)