0.0.6 • Published 3 months ago

prisma-database-rewinder v0.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

prisma-database-rewinder

npm version

prisma-database-rewinder is a port of database-rewinder for Prisma.
This library is designed to extremely fast clean up test database records in Integration tests using a database.
It's currently intended for use with Jest and PostgreSQL.

Installation

npm install prisma-database-rewinder
or
yarn add prisma-database-rewinder
or
pnpm add prisma-database-rewinder

Usage

At the beginning of your Jest test file, include the following setup:

// prepare prisma client for test db
const prismaTestClient = new PrismaClient();

const rewinder = new PrismaDatabaseRewinder(prismaTestClient);
beforeAll(async () => {
  await rewinder.beforeAll();
});
afterEach(async () => {
  await rewinder.afterEach();
});

This setup ensures that your test database is cleaned up before all tests run and after each test completes, keeping your database in a consistent state and ready for the next test.

0.0.6

3 months ago

0.0.5

3 months ago

0.0.4

3 months ago

0.0.3

3 months ago

0.0.2

3 months ago

0.0.1

3 months ago