/*! * V4Fire Client Core * https://github.com/V4Fire/Client * * Released under the MIT license * https://github.com/V4Fire/Client/blob/master/LICENSE */ import type { JSHandle } from 'playwright'; import type { ModuleMocker } from 'jest-mock'; /** * Represents a spy object with properties for accessing spy information. */ export interface SpyObject { /** * The array of arguments passed to the spy function on each call. */ readonly calls: Promise; /** * The number of times the spy function has been called. */ readonly callsCount: Promise; /** * The arguments of the most recent call to the spy function. */ readonly lastCall: Promise; /** * The results of each call to the spy function. */ readonly results: Promise; } /** * Represents a function that extracts or creates a spy object from a `JSHandle`. */ export interface SpyExtractor { /** * Extracts or creates a spy object from a `JSHandle`. * * @param ctx - the `JSHandle` containing the spy object. * @param args */ (ctx: CTX, ...args: ARGS): ReturnType; } /** * Extracts the type from a `JSHandle`. */ export type ExtractFromJSHandle = T extends JSHandle ? V : never;