Skip to content
Merged
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ yarn run lint

### Test

Disable API tests OR define all required explorer API keys.

```bash
export DISABLE_API_TESTS=1
# OR
export EXPLORER_API_KEY_MAINNET=
export EXPLORER_API_KEY_RINKEBY=
export EXPLORER_API_KEY_FUSE=
export EXPLORER_API_KEY_MATIC=
export EXPLORER_API_KEY_FANTOM=
```

Test all the packages in the monorepo.

```bash
Expand Down
18 changes: 18 additions & 0 deletions packages/payment-detection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,21 @@ The code generation is included in the pre-build script and can be run manually:
```
yarn codegen
```

# Test

The ETH `InfoRetriever` tests require explorer API keys. Before running the
payment-detection tests, define `DISABLE_API_TESTS` or define all required
explorer API keys.

```bash
export DISABLE_API_TESTS=1
# OR
export EXPLORER_API_KEY_MAINNET=
export EXPLORER_API_KEY_RINKEBY=
export EXPLORER_API_KEY_FUSE=
export EXPLORER_API_KEY_MATIC=
export EXPLORER_API_KEY_FANTOM=

yarn run test
```
10 changes: 9 additions & 1 deletion packages/payment-detection/test/eth/info-retriever.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ describe('api/eth/info-retriever', () => {
await expect(infoRetreiver.getTransferEvents()).rejects.toThrowError();
});

describe('Multichain', () => {
// Utility for conditionally skipping tests
const describeIf = (
condition: any,
...args: [string | number | Function | jest.FunctionLike, jest.EmptyFunction]
) => (condition ? describe(...args) : describe.skip(...args));

// Skip tests if build is from external fork or API tests are disabled
// External forks cannot access secret API keys
describeIf(!process.env.CIRCLE_PR_NUMBER && !process.env.DISABLE_API_TESTS, 'Multichain', () => {
// TODO temporary disable xDAI, CELO, Sokol, and Goerli
// FIXME: API-based checks should run nightly and be mocked for CI
[
Expand Down