LogoRobo.js
Packages@robojs/mock

getHistoricalActions()

Function: getHistoricalActions()

function getHistoricalActions(sessionId, options?): Promise<RecordedAction[]>

Get all historical actions from a session (including those from before test started).

This is useful for testing lifecycle hooks like ready events that fire during bot startup, before your test code begins waiting for actions.

Parameters

ParameterTypeDescription
sessionIdstring-
options?{ filter: (action) => boolean; type: string; }-
options.filter?(action) => booleanCustom filter function
options.type?stringFilter by action type

Returns

Promise<RecordedAction[]>

Example

// Check what happened during startup
const actions = await getHistoricalActions(bot.sessionId, {
  type: 'gateway_presence_update'
})
expect(actions.length).toBeGreaterThan(0)

On this page