( func: (this: Self, ...args: Args) => Promise<Return>, )
| 555 | * @returns The return value of the function. |
| 556 | */ |
| 557 | export function mockSessionAsync< |
| 558 | Self, |
| 559 | Args extends unknown[], |
| 560 | Return, |
| 561 | >( |
| 562 | func: (this: Self, ...args: Args) => Promise<Return>, |
| 563 | ): (this: Self, ...args: Args) => Promise<Return> { |
| 564 | return async function (this: Self, ...args: Args): Promise<Return> { |
| 565 | const id = sessions.length; |
| 566 | sessions.push(new Set()); |
| 567 | try { |
| 568 | return await func.apply(this, args); |
| 569 | } finally { |
| 570 | restore(id); |
| 571 | } |
| 572 | }; |
| 573 | } |
| 574 | |
| 575 | /** |
| 576 | * Restores all mocks registered in the current session that have not already been restored. |
no test coverage detected