TestStore_Step - mbrandonw/swift-composable-architecture GitHub Wiki

TestStore.Step

DEBUG

A single step of a TestStore assertion.

public struct Step

Initializers

init(_:file:line:)

DEBUG
private init(_ type: StepType, file: StaticString = #file, line: UInt = #line)

Properties

type

DEBUG
let type: StepType

file

DEBUG
let file: StaticString

line

DEBUG
let line: UInt

Methods

send(_:file:line:_:)

DEBUG

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

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

Parameters

  • action: - action: An action to send to the test store.
  • update: - update: A function that describes how the test store's state is expected to change.

Returns

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

receive(_:file:line:_:)

DEBUG

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

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

Parameters

  • action: - action: An action the test store should receive by evaluating an effect.
  • update: - update: A function that describes how the test store's state is expected to change.

Returns

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

environment(file:line:_:)

DEBUG

A step that updates a test store's environment.

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

Parameters

  • update: - update: A function that updates the test store's environment for subsequent steps.

Returns

A step that updates a test store's environment.

`do`(file:line:_:)

DEBUG

A step that captures some work to be done between assertions

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

Parameters

  • work: - work: A function that is called between steps.

Returns

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

⚠️ **GitHub.com Fallback** ⚠️