@postnord/dynamodb-test-suit
TypeScript icon, indicating that this package has built-in type declarations

0.0.13 • Public • Published

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()
})

Readme

Keywords

none

Package Sidebar

Install

npm i @postnord/dynamodb-test-suit

Weekly Downloads

1,011

Version

0.0.13

License

UNLICENSED

Unpacked Size

20.9 MB

Total Files

54

Last publish

Collaborators

  • cielomuyot.postnord
  • pn_rroble
  • damiant-postnord
  • erikedling
  • adamkillander
  • sculaste
  • bernhardhettman-pn
  • ashwin_postnord
  • fbopdin
  • elrmndo_pn
  • aliaksei.stryi-postnord
  • sang-canencia-npm-pn
  • pn-ost-base
  • retail-team-npm
  • eriklind-pn
  • postnord.aldee_mativo
  • raymund.galapate
  • romeo.obane
  • elias_sidenbladh
  • ncppublicservice
  • oaipostnord
  • pn-jroma
  • pn-foundation-deployer
  • pn-chester
  • pn-akilumanga
  • sabbir-rahman-sakib
  • jkaske-pn
  • pnrutbergphilip
  • pnorbert
  • kheycee.matarlo
  • johankarlsson-pn
  • sesam-publisher
  • vanessa.faith.abordo.postnord
  • avsceriola-pn
  • junlue-pn
  • pnncp-aftersales
  • mipe-pn
  • vbacalso
  • jonas_elfstrom
  • pn-webteam
  • postnord.npm
  • vbrigoli
  • jvalmores
  • vijilgirish
  • frqu300
  • access-login-publisher
  • joakim.hedlund.postnord
  • pn-fipe
  • pn-aronsson
  • m.usman
  • mahadiapn
  • ambots13