Skip to main content
Version: 1.x

Hooks

Hooks are functions triggered in different ocassions in corde tests executions All hooks are available bellow:

afterAll(function)

Use afterAll to execute something that you want to be executed after all tests run. A good example of something to be executed after all tests is the logout of your testing bot.

I.E:

afterAll(() => {
bot.destroy();
});
note

As corde self make it's bot login, it's make their logout also. So there is no need to worry about it.

beforeStart(function)

Use beforeStart to execute some function before all tests begin.

This can be, for instance, the login of your bot.

beforeStart(async () => {
await bot.login();
});
note

In corde tests lifecycle, all these functions are executed after corde login, this bot. Functions to be executed before it will be created future versions of corde.

The image bellow ilustrate the operation of each hook:

Corde hooks lifecycle