mock-pool.d.ts 974 B

12345678910111213141516171819202122232425
  1. import Pool from './pool'
  2. import MockAgent from './mock-agent'
  3. import { Interceptable, MockInterceptor } from './mock-interceptor'
  4. import Dispatcher from './dispatcher'
  5. export default MockPool
  6. /** MockPool extends the Pool API and allows one to mock requests. */
  7. declare class MockPool extends Pool implements Interceptable {
  8. constructor(origin: string, options: MockPool.Options);
  9. /** Intercepts any matching requests that use the same origin as this mock pool. */
  10. intercept(options: MockInterceptor.Options): MockInterceptor;
  11. /** Dispatches a mocked request. */
  12. dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandlers): boolean;
  13. /** Closes the mock pool and gracefully waits for enqueued requests to complete. */
  14. close(): Promise<void>;
  15. }
  16. declare namespace MockPool {
  17. /** MockPool options. */
  18. export interface Options extends Pool.Options {
  19. /** The agent to associate this MockPool with. */
  20. agent: MockAgent;
  21. }
  22. }