import type { Room } from "./room/base.js"; import type { State } from "./state/state.js"; export type IntegrationHookCallbackContext = { data: Readonly>; addClient: Room["addClient"]; addBot: Room["addBot"]; }; export type IntegrationHookCallback = (state: S, context: IntegrationHookCallbackContext) => void; /** * Additional data persisting through the room. * Use it to hold some test-related flags, * eg. `data.shuffle: false` to not shuffle Deck on game start. * * Will be frozen. */ export type IntegrationHookData = Record; /** * Depending on integration tests I might allow more hooks. */ export type IntegrationHookNames = "init" | "startPre" | "startPost"; /** * Pass `{ test: "integrationTestName" }` options while creating the room. * Your integration test callbacks will be executed on init or start hooks. */ export type IntegrationHooks = Partial> & { data?: IntegrationHookData; }>;