Socket
Book a DemoInstallSign in
Socket

@postnord/dynamodb-test-suit

Package Overview
Dependencies
Maintainers
14
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@postnord/dynamodb-test-suit

A set of methods to ease unit testing DynamoDB-based project

0.0.13
latest
npmnpm
Version published
Maintainers
14
Created
Source

A library that abstracts away the complexities of testing dynamodb-based project. It will run an in-memory version of DynamoDB locally and will give you a couple of methods that eliminates the need to mock db calls.

Installation

You need to have Java installed (since DynamoDB is written in it). Run npm i -D @postnord/dynamodb-test-suit and you're good to go.

Usage

// in your test suit
beforeAll(async () => {
  await testDbService.initTestDb()
  dbService.getMapper = () => testDbService.getMapper()
})

API

initTestDb()

Will initialize the DB connection and allow you to use the rest of the functions.

await initTestDb()

getTableSnapshot()

Will capture a snapshot of the table.

expect(await getTableSnapshot()).toMatchSnapshot()

flushTable()

Will drop the test DB.

afterAll(async () => {
  await flushTable()
})

FAQs

Package last updated on 05 May 2021

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.