1.0.14 • Published 4 months ago

ava-fixture-docker-db v1.0.14

Weekly downloads
3
License
MIT
Repository
github
Last release
4 months ago

ava-fixture-docker-db

acquire a fresh docker database container attached to your ava test context

JavaScript Style Guide semantic-release Greenkeeper badge CircleCI

usage

import ava, { TestInterface } from 'ava'
import { db, DbContext } from 'ava-fixture-docker-db'

const test = ava as TestInterface<DbContext>

test.beforeEach(t => db.setup(t.context)) // setup(context, dbOptions, dockerodeOptions)
test.afterEach(t => db.teardown(t.context))

test('some that needs a db!', async t => {
  t.is(t.context.dbConfig.username, 'postgres', 'has default postgres user')
  const containerData = await t.context.dbContainer.inspect()
  t.truthy(containerData.Image, 'has docker image')
  t.is(containerData.State.Status, 'running', 'db is running')
  t.is(Object.keys(containerData.HostConfig.PortBindings).length, 1, 'has host port exposed')
})

see the exported typescript typings or source for the simple additional APIs you can use in setup.

1.0.14

4 months ago

1.0.13

5 months ago

1.0.11

7 months ago

1.0.10

7 months ago

1.0.12

6 months ago

1.0.9

1 year ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago