https://github.com/arojunior/tests-with-nodejs-graphql
WIP - Integration tests with NodeJs and GraphQL
https://github.com/arojunior/tests-with-nodejs-graphql
graphql hacktoberfest nodejs
Last synced: about 1 year ago
JSON representation
WIP - Integration tests with NodeJs and GraphQL
- Host: GitHub
- URL: https://github.com/arojunior/tests-with-nodejs-graphql
- Owner: arojunior
- Created: 2019-01-21T12:19:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T13:59:21.000Z (over 3 years ago)
- Last Synced: 2025-04-07T13:21:35.496Z (over 1 year ago)
- Topics: graphql, hacktoberfest, nodejs
- Language: JavaScript
- Homepage:
- Size: 330 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Integration Tests with NodeJs and GraphQL
### Goal
It is using Docker, so to run it in the CI environment, I need to make sure that the database is up and with all migrations applied before run tests.
**How can I do it?**
The [arojunior/flyway:5.2.4](https://github.com/arojunior/flyway) image help to handle the migrations. It is using the "wait-for-it" script to wait for MySQL container before execute the migrations.
The other helper is the `config/setupTests.js` script. It is used to get the database up and wait for the migrations being applied before start the tests.
### What you can find here
- Boilerplate for NodeJs + GraphQL applications;
- Good example for types and schema organization;
- ESLint already configured.
### Problem that I want to solve for tests
- Reliable test, I mean, not just for schema;
- Easy to setup;
- Easy to understand;
### Runnning the tests
**Locally**
```sh
docker-compose up -d
```
After all the containers get up, you can run
```sh
yarn && yarn test
```
**On CI**
```sh
yarn && yarn test-ci
```
The `test-ci` script will execute the `setupTests.js` before running the tests, which is prepared to start all the containers and wait for the migrations to be completed