Testing
Instance Testing
To ensure reliable deployment, it's essential to thoroughly test your handler code. This involves setting up sample data in your databases, which helps verify that your indexing and data transformation logic work as expected.
To test your instance resources, start by configuring your testing environment correctly and setting the YAML Type to “instance”.
To test your instance, you'll need an RPC endpoint for the network your instance is built on. You can use any RPC provider, but we recommend this provider.
Once everything is configured, run the blockflow test
command.
The Blockflow CLI will initiate within a Dockerised environment, triggering your instance. If your setup includes a database, sample data will populate automatically. You can monitor this process directly from the terminal.
API Testing
After populating the databases, the next step is to test the APIs built on top of them. To do this, simply change the YAML type to “api”
Then, run the blockflow test
command. If any resources of type “api/rest” or “api/graphql” are defined, Blockflow will start the APIs on a local server at port 4000 with the respective slugs.
For resources of type “api/graphql”, Blockflow uses an Apollo Server instance, allowing you to easily browse and test GraphQL endpoints.
Blockflow provides a default GraphQL API handler based on your schema located at src/apis/graphql.ts
. You can use this handler to inspect and interact with your database locally.
Type in YAML
Instance Type:
When the YAML type is instance, the system reads configurations from the YAML file.
It fetches blocks and triggers specified instances according to the configurations.
API Type:
When the YAML type is api and an API resource is defined, a server is spun up locally on localhost:4000.
A default GraphQL API handler is generated automatically, allowing monitoring and interaction with databases.
Last updated