Cell API
    Preparing search index...

    Class TestApp

    The whole application in the test process (docs/design/agent-first.md R11): the DI container and the HTTP chain of the backend, loaded from source like cell dev does, without a port. Requests go through in-memory request and response objects; fetch returns a standard Response.

    const app = await createTestApp();
    expect(await (await app.fetch('/users')).json()).toEqual([...]);
    await app.close();
    Index
    options: TestAppOptions = {}
    server?: CellDevServer
    • Sends a request through the HTTP chain in memory; input is a path such as /users?page=2.

      Parameters

      • input: string
      • init: RequestInit = {}

      Returns Promise<Response>

    • A service of the container. The application runs in its own module instances (Vite's module runner), so a class or Symbol('X') the test imports from the project's sources is not the one the container knows: such identifiers are matched by class name or symbol description. For the exact identifiers, take them from import.

      Type Parameters

      • T

      Parameters

      • id: unknown

      Returns T

    • Imports a module the way the backend loaded it (/src/user-service.ts from the project root, or a package such as @celljs/core), so its classes and symbols identify the backend's components: app.get((await app.import('/src/user-service.ts')).UserService).

      Type Parameters

      • T = Record<string, any>

      Parameters

      • specifier: string

      Returns Promise<T>