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"

Writing 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 will have 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 code to run. In this code, we can verify expected outputs using assert.ok() function.

Running a test

To run a test on a specific function, right-click the function name in the tree and pick the Run IML test option.

The test will start and you'll see the output in the IML tests output channel.

Last updated