Write basic tests and assertions in Poku
Poku provides a familiar Node.js-style assertion API. Every assertion method accepts an optional human-readable message as its last argument, which is printed on both success and failure.
- Use
assertfor plain assertions. - Use
testto group logic and assertions into a unit test. - Use
describeto group test suites (supports nesting). - Use
itto label individual test cases inside adescribeblock.
import { assert, test, strict } from 'poku';
// Plain assertion
assert.strictEqual(1 + 2, 3, 'Math should add up');
// Unit test with grouping
test('sum', () => {
const actual = 2 + 3;
strict.strictEqual(actual, 5, 'It sums two numbers');
});