Socket
Socket
Sign inDemoInstall

ava-fixture-docker-db

Package Overview
Dependencies
215
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ava-fixture-docker-db

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


Version published
Weekly downloads
17
increased by1600%
Maintainers
2
Install size
8.40 MB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 28 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc