UNPKG

@zendesk/laika

Version:

Test, mock, intercept and modify Apollo Client's operations — in both browser and unit tests!

20 lines (18 loc) 451 B
/* eslint-disable no-promise-executor-return */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export const onNextTick = <Output, T extends (...args: any) => Output>( action: T, ) => new Promise<Output>((resolve, reject) => setTimeout(() => { try { resolve(action()) } catch (error: unknown) { reject(error) } }), ) export type WaitForResult<T> = { values?: T[] error?: unknown }[]