skipReceivedActions(strict:fileID:file:line:column:)

Clears the queue of received actions from effects.

TestStore.swift:2372
@MainActor func skipReceivedActions(strict: Bool = true, fileID: StaticString = #fileID, file filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) async

Parameters

strict

When true and there are no in-flight actions to cancel, a test failure will be reported.

fileID

The fileID.

filePath

The filePath.

line

The line.

column

The column.

Can be handy if you are writing an exhaustive test for a particular part of your feature, but you don’t want to explicitly deal with all of the received actions:

let store = TestStore(/* ... */)

await store.send(.buttonTapped) {
  // Assert on how state changed
}
await store.receive(\.response) {
  // Assert on how state changed
}

// Make it explicit you do not want to assert on any other received actions.
await store.skipReceivedActions()