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

Cancels any currently in-flight effects.

TestStore.swift:2457
@MainActor func skipInFlightEffects(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 effects:

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 how any other effects behave.
await store.skipInFlightEffects()