@types/supertest

  • Version 2.0.11
  • Published
  • 4.83 kB
  • 1 dependency
  • MIT license

Install

npm i @types/supertest
yarn add @types/supertest
pnpm add @types/supertest

Overview

TypeScript definitions for SuperTest

Index

Functions

function agent

agent: (app?: any, options?: AgentOptions) => SuperAgentTest;

    function supertest

    supertest: typeof supertest;

      Interfaces

      interface AgentOptions

      interface AgentOptions {}

        property ca

        ca?: any;

          interface Request

          interface Request extends superagent.SuperAgentRequest {}

            interface Response

            interface Response extends superagent.Response {}

              interface SuperTest

              interface SuperTest<T extends superagent.SuperAgentRequest>
              extends superagent.SuperAgent<T> {}

                method host

                host: (host: string) => T;

                  interface Test

                  interface Test extends superagent.SuperAgentRequest {}

                    property app

                    app?: any;

                      property url

                      url: string;

                        method end

                        end: (callback?: CallbackHandler) => this;

                          method expect

                          expect: {
                          (status: number, callback?: CallbackHandler): this;
                          (status: number, body: any, callback?: CallbackHandler): this;
                          (checker: (res: Response) => any, callback?: CallbackHandler): this;
                          (body: string, callback?: CallbackHandler): this;
                          (body: RegExp, callback?: CallbackHandler): this;
                          (body: Object, callback?: CallbackHandler): this;
                          (field: string, val: string, callback?: CallbackHandler): this;
                          (field: string, val: RegExp, callback?: CallbackHandler): this;
                          };

                            method serverAddress

                            serverAddress: (app: any, path: string) => string;

                              Type Aliases

                              type CallbackHandler

                              type CallbackHandler = (err: any, res: Response) => void;

                                type SuperAgentTest

                                type SuperAgentTest = SuperTest<Test> &
                                Pick<
                                Request,
                                | 'use'
                                | 'on'
                                | 'set'
                                | 'query'
                                | 'type'
                                | 'accept'
                                | 'auth'
                                | 'withCredentials'
                                | 'retry'
                                | 'ok'
                                | 'redirects'
                                | 'timeout'
                                | 'buffer'
                                | 'serialize'
                                | 'parse'
                                | 'ca'
                                | 'key'
                                | 'pfx'
                                | 'cert'
                                >;

                                  Package Files (1)

                                  Dependencies (1)

                                  Dev Dependencies (0)

                                  No dev dependencies.

                                  Peer Dependencies (0)

                                  No peer dependencies.

                                  Badge

                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/supertest.

                                  • Markdown
                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/supertest)
                                  • HTML
                                    <a href="https://www.jsdocs.io/package/@types/supertest"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>