Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitrii Coolerov committed Jul 8, 2022
1 parent 0a680c0 commit 3903879
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Highway.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Highway"
s.version = "0.11.0"
s.version = "0.12.0"
s.summary = "Unidirectional Data Flow in Swift"
s.description = <<-DESC
Highway is a mix of Redux-like and The Elm Architecture implementation of the unidirectional data flow architecture in Swift.
Expand Down
4 changes: 2 additions & 2 deletions Tests/HighwayTests/AutomaticallySkipRepeatsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ class AutomaticallySkipRepeatsTests: XCTestCase {
}

func testInitialSubscriptionWithRegularSubstateSelection() {
store.subscribe({ [unowned self] _ in
store.subscribe(listener: { [unowned self] _ in
self.subscriptionUpdates += 1
})
XCTAssertEqual(self.subscriptionUpdates, 0)
}

func testDispatchUnrelatedActionWithExplicitSkipRepeatsWithRegularSubstateSelection() {
store.subscribe({ [unowned self] _ in
store.subscribe(listener: { [unowned self] _ in
self.subscriptionUpdates += 1
})
XCTAssertEqual(self.subscriptionUpdates, 0)
Expand Down
2 changes: 1 addition & 1 deletion Tests/HighwayTests/ExpectThunk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ extension ExpectThunk {
createThunkMiddleware(
thunk: thunk,
action: initialAction
)(dispatch, getState, initialAction)
)(dispatch, getState(), initialAction)
return self
}

Expand Down
18 changes: 14 additions & 4 deletions Tests/HighwayTests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ private func fakeReducer(state: FakeState?, action: ThunkAction) -> FakeState {
class Tests: XCTestCase {

func testExpectThunkWaits() {
let thunk = Thunk<FakeState, ThunkAction, Void>(environment: ()) { dispatch, getState, _, _ in
let thunk = Thunk<FakeState, ThunkAction, Void>(environment: ()) { dispatch, state, _, _ in
dispatch(.fakeAction)
XCTAssertNotNil(getState())
XCTAssertNotNil(state)
DispatchQueue.global().asyncAfter(deadline: DispatchTime.now() + 0.5) {
dispatch(.anotherFakeAction)
XCTAssertNotNil(getState())
XCTAssertNotNil(state)
}
dispatch(.fakeAction)
}
Expand All @@ -56,7 +56,17 @@ class Tests: XCTestCase {
XCTFail("Unexpected action: \(action)")
}
}
.getsState(FakeState())
// TODO: getState() is need?
/*
dispatch(.fakeAction)
XCTAssertNotNil(state)
DispatchQueue.global().asyncAfter(deadline: DispatchTime.now() + 0.5) {
dispatch(.anotherFakeAction)
XCTAssertNotNil(state)
}
dispatch(.fakeAction)
*/
// .getsState(FakeState())
.dispatches { action in
switch action {
case .fakeAction:
Expand Down

0 comments on commit 3903879

Please sign in to comment.