An open API service indexing awesome lists of open source software.

https://github.com/forinda/prisma-mock-db-test

A testing express template for unit testing your express application
https://github.com/forinda/prisma-mock-db-test

expressjs mock-db prisma prisma-client prisma-mock prisma-orm test-db-mock testing typescript

Last synced: 3 months ago
JSON representation

A testing express template for unit testing your express application

Awesome Lists containing this project

README

          

# Prisma Singleton mock Expressjs with database testing

This is a simple implementation of mocking database tests without hitting the database
This is necessary and handy when testing functionalities of your application

To get started with the project

- Nodejs
- Expressjs
- SQLite
- Jest

Run
```sh
install
```
Then initialize your db
```sh
npx prisma init --datasource-provider sqlite
```
Make initial migrations
```sh
npx prisma migrate dev --name init
```

You can use the prisma studio to visualize the models defined
```sh
npx prisma studio
```
To run tour tests just run
```sh
npm run test
```
![Image](./assets/prisma.png)