This class sets rules when a configured setup should be applied to the target invocation or not.

Example


const value = 'value';
const object = new Mock<Function>()
.setup(instance => instance(1))
.play(PlayTimes.Once())
.returns(value)
.object();

expect(object(1).toBe(value);
expect(object(1).toBe(undefined);

Hierarchy

  • PlayTimes

Constructors

Methods

Constructors

Methods

  • The configured setup will be applied or not accordingly to the value in the sequence.

    Example


    const value = 'value';
    const object = new Mock<Function>()
    .setup(instance => instance(1))
    .play(PlayTimes.Sequence([false, true]))
    .returns(value)
    .object();

    expect(object(1).toBe(undefined);
    expect(object(1).toBe(value);
    expect(object(1).toBe(undefined);

    Parameters

    • sequence: boolean[]

    Returns IPlayable

Generated using TypeDoc