Test your plugin
This guide will help you test your plugin effectively using Qatium’s SDK Testing Library. We will test the plugin created in the previous section.
By following these steps, you can ensure that your plugin works correctly within the Qatium ecosystem.
Step 1: Setting up your development environment
Install Dependencies
Start by installing Qatium SDK Testing Library as development dependency:
Run Tests
Let’s add one dummy test, for example:
you can run tests with:
or enter in watch mode:
Step 2: Adding tests
Now, let’s make sure your plugin behaves as expected by adding tests.
Create a Test network
Begin by defining a network to use in your tests, we will use:
Which we can define as:
More information about building networks or using example networks is available in Building test networks.
Check Heatmap layer is added
When running, your plugin should add a Heatmap layer on top of closed valves, let’s verify it.
First, create an SDK mock using our test network, with it, we can instantiate the plugin and run it.
Verify the plugin called sdk.map.addOverlay
with the Heatmap layer.
Later, you can learn more about mocking the SDK.
Check Valves are closed
A message is sent from the UI to the plugin to close valves. Any plugin event can be simulated on tests.
Ensure that valves are closed when the message is received: