remyma / nestjs-integration-test-db-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example for NestJS Database Integration Testing

This repository is a quick, (not-working standalone) example, on how to setup a database for each test scenario.

Fixtures

In the folder src/test/fixtures are JSON files which will be used as test data. The file src/test/fixtures/_order.json defines in which order the entites should be inserted. This is made, to create relations between entities.

To clarify: The TeacherUser has the foreign key user and teacher. In order to insert the TeacherUser, the test.utils.ts-Component needs to know the order of the entities. Because TeacherUser can not be inserted, without an User or Teacher entity.

About


Languages

Language:TypeScript 100.0%