Write IML tests
When using IML functions, that work with date and time, remember to set the correct timezone in extension settings. The accepted format is the international timezone format.
For example "Europe/Prague"
Write a test
It's possible to write tests for your custom IML functions. You can use it
function and asserts
as you may already know them from Mocha and other testing frameworks.
Our example function has the following code:
So, let's write a test for this function. We'll create two blocks.
As you can see, the it
function accepts exactly two parameters, the name of the test and the code to run. In this code, we can verify expected outputs using assert.ok()
function.
Run a test
To run a test on a specific function, right-click the function name in the tree and select the Run IML test option.
The test will start and you'll see the output in the IML tests output channel.
If you need to debug your custom IML function, follow the article below.
Last updated