Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils/testSupport/TestingUtils

Functions

findControlByProperty

  • findControlByProperty(rootControl: IControl, property: string, value: any): any
  • Find the control with the specified property name and value in the control tree

    Parameters

    • rootControl: IControl

      Root control

    • property: string

      Property name

    • value: any

      Property value

    Returns any

findControlInTreeById

  • findControlInTreeById(rootControl: IControl, id: string): any
  • Find the control with the specified id in the control tree

    Parameters

    • rootControl: IControl

      Root control

    • id: string

      Control id to search for

    Returns any

simpleInvoke

  • Invokes the core handling method of ControlHandler

    Purpose:

    • for unit-testing the handling functionality (without rendering).

    Parameters

    Returns Promise<IControlResult>

testE2E

  • Tests a multi-turn script, verifying that the correct prompts are produced on each turn.

    For finer-grained control, for assertions and breakpoints, use a sequence of calls to testTurn.

    Each user turn comprises three entries:

    1. The user utterance. This is not a functional parameter is for documentation / readability.
    2. The input object for the turn. This should be synchronized with the user-utterance.
    3. The expected response for the turn: prompt, set of allowed prompts or TestResponse object.

    The user utterance and expected prompt can start with 'U: ' and 'A: ' to aid readability.

    Parameters

    Returns Promise<void>

testTurn

  • Test a single turn through the complete runtime flow

    Parameters

    • invoker: SkillInvoker

      SkillInvoker

    • utterance: string

      Utterance. This is only for documentation / readability.

    • input: IControlInput

      Input object

    • expectedResponse: string | string[] | TestResponseObject

      The expected response: prompt, set of allowed prompts or TestResponse object.

    Returns Promise<TestResponseObject>

waitForDebugger

  • waitForDebugger(): void
  • Returns void