Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Latest commit

 

History

History
130 lines (95 loc) · 2.92 KB

DEV.md

File metadata and controls

130 lines (95 loc) · 2.92 KB

Dev environment

Setup

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 git@github.com:GaloyMoney/dealer.git
$ cd dealer
$ direnv allow
direnv reload
direnv: direnv: loading ~/projects/GaloyMoney/dealer/.envrc
(...)
$ yarn install

Development

To start all in docker:

$ make start

Migrate the database the first time around:

$ make migrate-db

Testing

To run the test suite you can run:

$ make test

To execute the test suite.

Run unit tests

$ yarn test:unit
# or
$ make unit

Run integration tests

To execute the integration tests.

$ yarn test:integration
# or
$ make integration

Run specific test file

To execute a specific test file:

Unit

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

Integration

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

Running checks

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 .

Contributing

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.