Skip to content

Commit

Permalink
fix: allow custom store name
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Shaw committed Nov 24, 2022
1 parent 00af940 commit 7f6e957
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/access-client/src/stores/store-indexeddb.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function withObjectStore(db, txnMode, storeName, fn) {
reject(new Error('transaction error', { cause: tx.error }))
)
try {
result = await fn(tx.objectStore(STORE_NAME))
result = await fn(tx.objectStore(storeName))
tx.commit()
} catch (error) {
reject(error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ describe('IndexedDB store', () => {
assert.equal(data.meta.type, 'device')
})

it('should allow custom store name', async () => {
const store = await StoreIndexedDB.create('test-access-db-' + Date.now(), {
dbStoreName: `store-${Date.now()}`,
})
const data = await store.load()
assert(data)
})

it('should check existence', async () => {
const store = new StoreIndexedDB('test-access-db-' + Date.now())
await store.open()
Expand Down

0 comments on commit 7f6e957

Please sign in to comment.