This setup was last tested with the following tools:
$ node --version
v14.17.5
$ yarn --version
1.22.5
$ direnv --version
2.21.2
$ docker --version
Docker version 20.10.8, build 3967b7d
$ docker-compose --version
docker-compose version 1.25.0, build unknown
We use direnv to load environment variables needed for running the integration tests.
Don't forget to add the direnv hook to your shell.rc
file.
The host of these two environment variables depends on where the resource is running (docker host, local host, etc.)
- GRAPHQL_URI="http://:4000/graphql"
- DATABASE_URL="postgres://postgres:postgres@:5432/galoy"
Clone the repo and install dependencies:
$ git clone [email protected]:GaloyMoney/dealer.git
$ cd dealer
$ direnv allow
direnv reload
direnv: direnv: loading ~/projects/GaloyMoney/dealer/.envrc
(...)
$ yarn install
To start all in docker:
$ make start
Migrate the database the first time around:
$ make migrate-db
To run the test suite you can run:
$ make test
To execute the test suite.
$ yarn test:unit
# or
$ make unit
To execute the integration tests.
$ yarn test:integration
# or
$ make integration
To execute a specific test file:
Example to run test/unit/OkexExchangeConfiguration.spec.ts
$ TEST=utils yarn test:unit
# or
$ TEST=utils make unit
where utils
is the name of the file utils.spec.ts
Example to run test/integration/Dealer.spec.ts
$ TEST=Dealer yarn test:integration
# or
$ TEST=Dealer make integration
if within a specific test suite you want to run/debug only a describe or it(test) block please use:
- describe.only: just for debug purposes
- it.only: just for debug purposes
- it.skip: use it when a test is temporarily broken. Please don't commit commented test cases
It's recommended that you use plugins in your editor to run ESLint checks and perform Prettier formatting on-save.
To run all the checks required for the code to pass GitHub actions check:
$ make check-code
(...)
$ echo $?
0
If you need to run Prettier through the command line, you can use:
$ yarn prettier -w .
When opening a PR please pay attention to having a clean git history with good commit messages. It is the responsibility of the PR author to resolve merge conflicts before a merge can happen. If the PR is open for a long time a rebase may be requested.