Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

fix: open store in tests #66

Merged
merged 1 commit into from
Jan 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions src/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ module.exports = (test) => {
await test.teardown()
}

const createStore = async () => {
const store = await test.setup()
if (!store) throw new Error('missing store')
await store.open()
return store
}

describe('put', () => {
/** @type {Datastore} */
let store

beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
store = await createStore()
})

afterEach(() => cleanup(store))
Expand Down Expand Up @@ -61,8 +67,7 @@ module.exports = (test) => {
let store

beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
store = await createStore()
})

afterEach(() => cleanup(store))
Expand Down Expand Up @@ -92,8 +97,7 @@ module.exports = (test) => {
let store

beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
store = await createStore()
})

afterEach(() => cleanup(store))
Expand Down Expand Up @@ -124,8 +128,7 @@ module.exports = (test) => {
let store

beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
store = await createStore()
})

afterEach(() => cleanup(store))
Expand Down Expand Up @@ -159,8 +162,7 @@ module.exports = (test) => {
let store

beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
store = await createStore()
})

afterEach(() => cleanup(store))
Expand Down Expand Up @@ -198,8 +200,7 @@ module.exports = (test) => {
let store

beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
store = await createStore()
})

afterEach(() => cleanup(store))
Expand Down Expand Up @@ -234,8 +235,7 @@ module.exports = (test) => {
let store

beforeEach(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
store = await createStore()
})

afterEach(() => cleanup(store))
Expand Down Expand Up @@ -342,8 +342,7 @@ module.exports = (test) => {
]

before(async () => {
store = await test.setup()
if (!store) throw new Error('missing store')
store = await createStore()

const b = store.batch()

Expand Down