P5-7496: orders tests (#3)
* P5-7495: added more db data and more designer tests * P5-7496: rebuild for sql export, added better test control values * changed order rows - edge from int to string * added tests for designer order rows * remove sql inserts * Some cleanup and moving files * package * removed comments * added base sql files to pass tests on github CI
This commit is contained in:
@@ -8,8 +8,25 @@ Create an .env file (see .env.example for what to set).
|
||||
Run
|
||||
|
||||
```
|
||||
$ docker-compose build
|
||||
$ docker-compose up
|
||||
$ docker compose build
|
||||
$ docker compose up
|
||||
```
|
||||
|
||||
Then head over to [The playground GUI](https://localhost:4000) in the browser
|
||||
|
||||
## Run tests
|
||||
|
||||
Scripts will create the insert sql files for a randomized fake data postgres database. This database is based of the actual db in photowall project.
|
||||
```
|
||||
npm test
|
||||
```
|
||||
|
||||
### Writing tests
|
||||
|
||||
The tests are held in testcontainers [testcontainers-node](https://github.com/testcontainers/testcontainers-node). One container holding a test postgres database and one container started from the Dockerfile containing the Apollo GraphQL server. These containers have connections with each other.
|
||||
|
||||
Each test is build around inserting fake data in the empty db, fetching that data through the GraphQL and with raw Sql queries and then comparing the results.
|
||||
|
||||
To write new inserts into the DB generate sql files with js in the src/__test__/db_generator tool. Then load the new sql file in the containerSetup.ts file.
|
||||
|
||||
When you have the data you need in the db, write tests in all.test.ts file following the pattern already set.
|
||||
|
||||
Reference in New Issue
Block a user