🧪 it
it(message: string, cb: () => void)|it(cb: () => void)
it is a helper to assist you in such cases:
- Use the
beforeEachandafterEachfor eachitperformed
Basic Usage
Grouping tests
import { describe, it, assert } from 'poku';
describe('Calc suite', () => {
it('Sums', () => {
assert.equal(1 + 1, 2);
assert.equal(2 + 2, 4);
});
it('Div', () => {
assert.equal(1 / 1, 1);
assert.equal(2 / 2, 1);
});
});
Waiting for promises
import { describe, it } from 'poku';
await describe(async () => {
await it(async () => {
// do anything you want
});
await it(async () => {
// do anything you want
});
});
Running in parallel
import { describe, it } from 'poku';
describe(() => {
it(async () => {
// do anything you want
});
it(async () => {
// do anything you want
});
});
Waiting for multiple promises
import { describe, it } from 'poku';
await describe(async () => {
// do something before
await Promise.all([
it(async () => {
// do anything you want
}),
it(async () => {
// do anything you want
}),
]);
// do something after
});
tip
You can think on it as beforeAll and afterAll.