Skip to content

Commit

Permalink
Update TestStore ordering (#69)
Browse files Browse the repository at this point in the history
update TestStore ordering
  • Loading branch information
adityadaniel authored Jan 5, 2023
1 parent 4f72a79 commit 8bdc761
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Sources/RxComposableArchitecture/TestSupport/TestStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ extension TestStore where State == LocalState, Action == LocalAction {
extension TestStore where LocalState: Equatable {
public func send(
_ action: LocalAction,
_ updateExpectingResult: ((inout LocalState) throws -> Void)? = nil,
file: StaticString = #file,
line: UInt = #line,
_ updateExpectingResult: ((inout LocalState) throws -> Void)? = nil
line: UInt = #line
) {
if !receivedActions.isEmpty {
var actions = ""
Expand Down Expand Up @@ -451,9 +451,9 @@ extension TestStore where LocalState: Equatable, Action: Equatable {
/// expected.
public func receive(
_ expectedAction: Action,
_ updateExpectingResult: ((inout LocalState) throws -> Void)? = nil,
file: StaticString = #file,
line: UInt = #line,
_ updateExpectingResult: ((inout LocalState) throws -> Void)? = nil
line: UInt = #line
) {
guard !receivedActions.isEmpty else {
XCTFail(
Expand Down Expand Up @@ -525,9 +525,9 @@ extension TestStore where LocalState: Equatable, Action: Equatable {
func assert(step: Step) {
switch step.type {
case let .send(action, update):
self.send(action, file: step.file, line: step.line, update)
self.send(action, update, file: step.file, line: step.line)
case let .receive(expectedAction, update):
self.receive(expectedAction, file: step.file, line: step.line, update)
self.receive(expectedAction, update, file: step.file, line: step.line)
case let .environment(work):
if !self.receivedActions.isEmpty {
var actions = ""
Expand Down
9 changes: 5 additions & 4 deletions Tests/RxComposableArchitectureTests/StoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ internal final class StoreTests: XCTestCase {
}

var numCalls1 = 0
_ = Store(initialState: 0, reducer: counterReducer, environment: ())
_ = Store(initialState: 0, reducer: counterReducer, environment: (), useNewScope: false)
.scope(state: { (count: Int) -> Int in
numCalls1 += 1
return count
Expand Down Expand Up @@ -129,7 +129,7 @@ internal final class StoreTests: XCTestCase {
var numCalls2 = 0
var numCalls3 = 0

let store = Store(initialState: 0, reducer: counterReducer, environment: ())
let store = Store(initialState: 0, reducer: counterReducer, environment: (), useNewScope: false)
.scope(state: { (count: Int) -> Int in
numCalls1 += 1
return count
Expand Down Expand Up @@ -239,7 +239,7 @@ internal final class StoreTests: XCTestCase {
Item(id: $0, qty: 1)
}

let store = Store(initialState: IdentifiedArrayOf(mock), reducer: itemReducer, environment: ())
let store = Store(initialState: IdentifiedArrayOf(mock), reducer: itemReducer, environment: (), useNewScope: false)
.scope(state: { (item: IdentifiedArrayOf<Item>) -> IdentifiedArrayOf<Item> in
numCalls1 += 1
return item
Expand Down Expand Up @@ -500,7 +500,8 @@ internal final class StoreTests: XCTestCase {
return .none
}
},
environment: ()
environment: (),
useNewScope: false
)

var emissions: [Int] = []
Expand Down

0 comments on commit 8bdc761

Please sign in to comment.