TestInterceptor

public class TestInterceptor<State> : Interceptor

An Interceptor to use in unit tests, to assert specific Actions are dispatched.

  • A list of Actions and States intercepted.

    Declaration

    Swift

    public private(set) var stateChanges: [(action: Action, oldState: State, newState: State)] { get set }
  • Initializes the TestInterceptor.

    Declaration

    Swift

    public init()
  • Declaration

    Swift

    public func actionDispatched(action: Action, oldState: State, newState: State)
  • Waits for the expected number of Actions to be intercepted. If the expected number of Actions are not intercepted before the timout an error is thrown.

    Declaration

    Swift

    public func waitForActions(expectedNumberOfActions: Int, timeout: TimeInterval = 1) throws

    Parameters

    expectedNumberOfActions

    The number of Actions to wait for

    timeout

    The waiting time before failing (in seconds)

  • Errors waiting for intercepted Actions

    See more

    Declaration

    Swift

    public enum WaitingError : Error