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