Class SubcaseParamsBuilder<CaseP, SubcaseP>

Builder for combinatorial test subcase parameters.

SubcaseParamsBuilder is immutable. Each method call returns a new, immutable object, modifying the list of subcases according to the method called.

Type Parameters

  • CaseP extends {}

  • SubcaseP extends {}

Hierarchy

Implements

Constructors

  • Type Parameters

    • CaseP extends {}

    • SubcaseP extends {}

    Parameters

    • cases: ((caseFilter) => Generator<CaseP, any, unknown>)
        • (caseFilter): Generator<CaseP, any, unknown>
        • Parameters

          Returns Generator<CaseP, any, unknown>

    • generator: ((_) => Generator<SubcaseP, any, unknown>)
        • (_): Generator<SubcaseP, any, unknown>
        • Parameters

          • _: CaseP

          Returns Generator<SubcaseP, any, unknown>

    Returns SubcaseParamsBuilder<CaseP, SubcaseP>

Methods

  • Expands each item in this to multiple items with { [name]: value } for each value.

    In other words, takes the cartesian product of [ the items in this ] and [ {[name]: value} for each value in values ]

    Type Parameters

    • NewPKey extends string

    • NewPValue

    Parameters

    • key: NewPKey
    • values: Iterable<NewPValue>

    Returns SubcaseParamsBuilder<CaseP, Merged<SubcaseP, {
        [name in string]: NewPValue
    }>>

  • Expands each item in this to multiple items, one for each item in newParams.

    In other words, takes the cartesian product of [ the items in this ] and newParams.

    Note: When only a single key is being added, use the simpler combine for readability.

                        this = [ {a:1}, {b:2} ]
                   newParams = [ {x:1}, {y:2} ]
    this.combineP(newParams) = [ {a:1,x:1}, {a:1,y:2}, {b:2,x:1}, {b:2,y:2} ]
    

    Type Parameters

    • NewP extends {}

    Parameters

    • newParams: Iterable<NewP>

    Returns SubcaseParamsBuilder<CaseP, Merged<SubcaseP, NewP>>

  • Expands each item in this into zero or more items. Each item has its parameters expanded with one new key, key, and the values returned by expander.

    Type Parameters

    • NewPKey extends string

    • NewPValue

    Parameters

    • key: NewPKey
    • expander: ((_) => Iterable<NewPValue>)
        • (_): Iterable<NewPValue>
        • Parameters

          • _: Merged<CaseP, SubcaseP>

          Returns Iterable<NewPValue>

    Returns SubcaseParamsBuilder<CaseP, Merged<SubcaseP, {
        [name in string]: NewPValue
    }>>

  • Expands each item in this into zero or more items. Each item has its parameters expanded with those returned by the expander.

    Note: When only a single key is being added, use the simpler expand for readability.

                  this = [     a       ,      b     ,       c       ]
    this.map(expander) = [   f(a)           f(b)          f(c)      ]
                       = [[a1, a2, a3] ,    [ b1 ]  ,       []      ]
     merge and flatten = [ merge(a, a1), merge(a, a2), merge(a, a3), merge(b, b1) ]
    

    Type Parameters

    • NewP extends {}

    Parameters

    • expander: ((_) => Iterable<NewP>)
        • (_): Iterable<NewP>
        • Parameters

          • _: Merged<CaseP, SubcaseP>

          Returns Iterable<NewP>

    Returns SubcaseParamsBuilder<CaseP, Merged<SubcaseP, NewP>>

Generated using TypeDoc