Stratal API Reference
    Preparing search index...

    TestResponse

    Wrapper around Response with assertion methods.

    response
    .assertOk()
    .assertStatus(200)
    .assertJsonPath('data.id', userId)

    Hierarchy

    • Macroable
      • TestResponse

    Indexable

    • [key: string | symbol]: unknown
    Index

    Constructors

    Properties

    getterNames: Set<string | symbol>

    Names registered via getter() — used by hasMacro() and flushMacros().

    instanceMacros: Set<{ key: string | symbol; value: unknown }>

    Per-instance properties. Each entry is applied and bound to this inside the constructor so destructuring stays safe.

    macroNames: Set<string | symbol>

    Names registered via macro() — used by hasMacro() and flushMacros().

    Accessors

    Methods

    • Assert JSON value at path matches a custom predicate.

      Parameters

      • path: string

        Dot-notation path (e.g., 'data.items')

      • matcher: (value: unknown) => boolean

        Predicate function to validate the value

      Returns Promise<TestResponse>

    • Remove all macros, instance properties, and getters registered on this class. Does not affect parent classes.

      Returns void

    • Register a computed getter on the class prototype.

      Type Parameters

      • T extends Constructor
      • K extends string | number | symbol

      Parameters

      • this: T
      • name: K

        Property name

      • accumulator: (this: InstanceType<T>) => InstanceType<T>[K]

        Function that computes the value (called with instance as this)

      • Optionalsingleton: boolean

        If true, cache the value after first access

      Returns void

    • Register a computed getter on the class prototype.

      Parameters

      • name: string | symbol

        Property name

      • accumulator: MacroFunction

        Function that computes the value (called with instance as this)

      • Optionalsingleton: boolean

        If true, cache the value after first access

      Returns void

    • Check if a macro, instance property, or getter is registered.

      Parameters

      • name: string | symbol

        Name to check

      Returns boolean

    • Register a per-instance property that is bound to this in the constructor. Safe for destructuring.

      When the name matches an existing property, the value type is auto-derived.

      Type Parameters

      • T extends Constructor
      • K extends string | number | symbol

      Parameters

      • this: T
      • name: K

        Property name

      • value: InstanceType<T>[K]

        Function (will be bound) or value

      Returns void

    • Register a per-instance property that is bound to this in the constructor. Safe for destructuring.

      When the name matches an existing property, the value type is auto-derived.

      Parameters

      • name: string | symbol

        Property name

      • value: unknown

        Function (will be bound) or value

      Returns void

    • Register a macro on the class prototype. Can override existing methods.

      When the name matches an existing property, the value type is auto-derived.

      Type Parameters

      • T extends Constructor
      • K extends string | number | symbol

      Parameters

      • this: T
      • name: K

        Method or property name

      • value: InstanceType<T>[K]

        Function or value to assign

      Returns void

    • Register a macro on the class prototype. Can override existing methods.

      When the name matches an existing property, the value type is auto-derived.

      Parameters

      • name: string | symbol

        Method or property name

      • value: unknown

        Function or value to assign

      Returns void