0

using Jest, DynamoDB Local, I wanna reset database for each test so it doesn't have to be in specific order. Is there any way to do that wisely?

beforeEach(() => {
 resetDB()
})

it('create a data', () => {

})

it('remove the data', () => {

})

it('find the data', () => {
 test should pass but it fails because the data is removed.
})
skyboyer
  • 22,209
  • 7
  • 57
  • 64
Otani Shuzo
  • 1,118
  • 1
  • 11
  • 22

1 Answers1

-2

I would look into @shelf/jest-dynamodb to get started.

I wrote a testing library for AWS services, but it uses the real DyanmoDB and not the local version. You could try using the code here to delete all items from a table.

Erez
  • 1,690
  • 8
  • 9