Step

public struct Step

A single step of a TestStore assertion.

  • A step that describes an action sent to a store and asserts against how the store’s state is expected to change.

    Declaration

    Swift

    public static func send(
      _ action: LocalAction,
      file: StaticString = #file,
      line: UInt = #line,
      _ update: @escaping (inout LocalState) -> Void = { _ in }
    ) -> Step

    Parameters

    action

    An action to send to the test store.

    update

    A function that describes how the test store’s state is expected to change.

    Return Value

    A step that describes an action sent to a store and asserts against how the store’s state is expected to change.

  • A step that describes an action received by an effect and asserts against how the store’s state is expected to change.

    Declaration

    Swift

    public static func receive(
      _ action: Action,
      file: StaticString = #file,
      line: UInt = #line,
      _ update: @escaping (inout LocalState) -> Void = { _ in }
    ) -> Step

    Parameters

    action

    An action the test store should receive by evaluating an effect.

    update

    A function that describes how the test store’s state is expected to change.

    Return Value

    A step that describes an action received by an effect and asserts against how the store’s state is expected to change.

  • A step that updates a test store’s environment.

    Declaration

    Swift

    public static func environment(
      file: StaticString = #file,
      line: UInt = #line,
      _ update: @escaping (inout Environment) -> Void
    ) -> Step

    Parameters

    update

    A function that updates the test store’s environment for subsequent steps.

    Return Value

    A step that updates a test store’s environment.

  • A step that captures some work to be done between assertions

    Declaration

    Swift

    public static func `do`(
      file: StaticString = #file,
      line: UInt = #line,
      _ work: @escaping () -> Void
    ) -> Step

    Parameters

    work

    A function that is called between steps.

    Return Value

    A step that captures some work to be done between assertions.