0.2.5 • Published 9 months ago

testcontainers-dynamo-node v0.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

testcontainers-dynamo-node

An implementation of DynamoDB using the v3 sdk for Testcontainers

For more information on Testcontainers, see the Testcontainers documentation

Usage

import { DynamoContainer, StartedDynamoContainer, InitialStructure } from 'testcontainers-dynamo-node'

const initData: InitialStructure[] = [
  {
    table: {
      TableName: 'foo-table',
      AttributeDefinitions: [
        {
          AttributeName: 'PK',
          AttributeType: 'S',
        },
      ],
      KeySchema: [
        {
          AttributeName: 'PK',
          KeyType: 'HASH',
        },
      ],
      ProvisionedThroughput: {
        ReadCapacityUnits: 1,
        WriteCapacityUnits: 1,
      },
    },
    items: [
      {
        PK: '1',
        data: 'foo',
      },
      {
        PK: '2',
        data: 'bar',
      },
    ],
  },
]

const container = await new DynamoContainer(initData).start()
await container.createDynamoClient().listTables() // { TableNames: ['foo-table'] }
await container.createDocumentClient().scan({ TableName: 'foo-table' }) // { Items: [{ PK: '1', data: 'foo' }, { PK: '2', data: 'bar' }] }
await container.setData() // reset to initial state or provide an override
0.2.1

9 months ago

0.2.0

9 months ago

0.2.2-alpha

9 months ago

0.2.3

9 months ago

0.2.2-alpha.1

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.1.1

11 months ago

0.1.0

11 months ago