What does a first-pass test look like?

const test = require("/test/test-helper.xqy");
const myLib = require("/lib/myLibrary.sjs");

myLib.doSomething();

test.success();

That’s about as simple as it gets. What’s the benefit of a test that looks like this? There are two.

First, by simply importing the library and calling the function, we have established that we don’t have any syntax errors in the library. Since there’s no compilation stage, this is already beneficial.

Second, we’ve established that the test suite, with whatever setup and teardown we might have, work correctly. Once we can run this test and see that it passes, we can start to add more interesting assertions.