Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ExpectAttribute<T>

Apply an expectation on a target attribute attName.

❕ The function expectAttribute is generally used to construct ExpectAttribute expectation.

Type parameters

  • T

    The type of FulfilledExpectation.value, i.e. the type of the expectation return's value (normalized value) when the expectation is fulfilled

Hierarchy

Index

Constructors

constructor

Properties

Readonly attName

attName: string

Readonly description

description: string

description of the expectation

Readonly expectation

expectation: IExpectation<T>

Readonly normalizeTo

normalizeTo: (accData: any) => T = ...

Type declaration

    • (accData: any): T
    • Parameters

      • accData: any

      Returns T

Readonly when

when: ((inputData: any) => boolean) | BaseExpectation<T>

Methods

resolve

  • Resolve the expectation

    The expectation get fulfilled if both: (i) the attribute attName exist in the inputData, and (ii) expectation resolve to FulfilledExpectation when applied on inputData[attName].

    If the attName do not exist in the inputData, expectation is not evaluated.

    The normalized data is the result of the provided normalizeTo function evaluated from this.expectation.resolve(inputData[attName]).

    Parameters

    • inputData: unknown

      Input data to evaluate the expectation on

    Returns ExpectationStatus<T>

    Expectation status from given inputData

Generated using TypeDoc