Skip to content

Commit 3b1fabe

Browse files
authored
Unavailable TestStore.send/receive when state/action is not Equatable (#1890)
* Add unavailable TestStore.send/receive. * wip * wip
1 parent 5e4caa8 commit 3b1fabe

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Sources/ComposableArchitecture/TestStore.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2433,3 +2433,31 @@ private func _XCTExpectFailure(
24332433
XCTExpectFailureWithOptionsInBlock(failureReason, options, failingBlock)
24342434
#endif
24352435
}
2436+
2437+
extension TestStore {
2438+
@MainActor
2439+
@available(
2440+
*,
2441+
unavailable,
2442+
message: "State and Action must conform to Equatable to receive actions."
2443+
)
2444+
public func receive(
2445+
_ expectedAction: Action,
2446+
assert updateStateToExpectedResult: ((inout ScopedState) throws -> Void)? = nil,
2447+
file: StaticString = #file,
2448+
line: UInt = #line
2449+
) async {
2450+
}
2451+
2452+
@MainActor
2453+
@discardableResult
2454+
@available(*, unavailable, message: "State must conform to Equatable to send actions.")
2455+
public func send(
2456+
_ action: ScopedAction,
2457+
assert updateStateToExpectedResult: ((inout ScopedState) throws -> Void)? = nil,
2458+
file: StaticString = #file,
2459+
line: UInt = #line
2460+
) async -> TestStoreTask {
2461+
TestStoreTask(rawValue: nil, timeout: 0)
2462+
}
2463+
}

0 commit comments

Comments
 (0)