Skip to content

Latest commit

 

History

History
70 lines (42 loc) · 2.06 KB

README.md

File metadata and controls

70 lines (42 loc) · 2.06 KB

Tests

This directory contains tests for the webhook API. The tests are written using Vitest.

Requirements

To run the tests, you need to have the following installed:

Suites

Two suites are available for testing the webhook API, acceptance and integration tests.

To install the dependencies for the tests, run:

make prepare-tests

Acceptance tests

These tests simulate the interaction between the Jupiter RFQ module and the webhook API. The tests are useful to verify that your implementation is compatible with the Jupiter RFQ module,

The tests can be found in the acceptance directory.

To run the tests, you need to provide the webhook URL:

WEBHOOK_URL=<your_webhook_url> make run-acceptance-tests

for an example, you can run the tests against the bundled sample server:

make run-acceptance-tests-against-sample-server

To run the test directly with pnpm run:

pnpm run acceptance

Integration tests

Integration tests are end to end tests that simulate the user interaction. The tests are running against our edge (pre-production) environment and require that the webhook has been registered with Jupiter RFQ.

The tests can be found in the integration directory.

TAKER_KEYPAIR=<path_to_your_keypair.json> \
WEBHOOK_ID=<your_webhook_id> \
make run-integration-tests

By default, the tests will attempt to get a quote for 1 USDC to SOL, upon a successful quote, the tests will proceed to swap the tokens. To modify the parameters of the quote and swap, you can override the environment variables defined in the params.ts file.

⚠️ Warning: Running the integration tests will perform a real swap on the Solana mainnet. Make sure you have the necessary funds in your wallet before running the tests.

To run the test directly with pnpm run:

pnpm run integration