Documentation
    Preparing search index...

    Test utils has a collection of helper methods to make testing experience great for AdonisJS applications. It provides utilities for HTTP testing, context creation, and cookie handling.

    const testUtils = new TestUtils(app)
    await testUtils.boot()

    const ctx = await testUtils.createHttpContext()
    const httpUtils = testUtils.httpServer()

    Hierarchy

    • default
      • TestUtils
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    cookies: CookieClient

    Cookie client instance for handling cookies in tests

    The application service instance

    Accessors

    Methods

    • Boot test utils. It requires the app to be booted and container to have all the bindings

      Returns Promise<void>

    • Create an instance of HTTP context for testing

      Parameters

      • options: { req?: IncomingMessage; res?: ServerResponse<IncomingMessage> } = {}

        Options for creating HTTP context with custom req/res objects

      Returns Promise<HttpContext>