Skip to content

Commit

Permalink
Fix compiler error in AppTelemetryReducerTests
Browse files Browse the repository at this point in the history
Wrap tested reducers in CombineReducers higher-order reducer to fix
issue when swift compiler is unable to resolve generic types
correctly.
  • Loading branch information
darrarski committed Apr 18, 2024
1 parent 4be3ad6 commit 39272e1
Showing 1 changed file with 36 additions and 20 deletions.
56 changes: 36 additions & 20 deletions app/Tests/AppFeatureTests/AppTelemetryReducerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ final class AppTelemetryReducerTests: XCTestCase {
}
let signals = LockIsolated<[AppTelemetrySignal]>([])
let store = TestStore(initialState: ExampleReducer.State()) {
ExampleReducer()
AppTelemetryReducer()
CombineReducers {
ExampleReducer()
AppTelemetryReducer()
}
} withDependencies: {
$0.appTelemetry.send = { @Sendable signal in
signals.withValue { $0.append(signal) }
Expand Down Expand Up @@ -107,8 +109,10 @@ final class AppTelemetryReducerTests: XCTestCase {
}
let signals = LockIsolated<[AppTelemetrySignal]>([])
let store = TestStore(initialState: ExampleReducer.State()) {
ExampleReducer()
AppTelemetryReducer()
CombineReducers {
ExampleReducer()
AppTelemetryReducer()
}
} withDependencies: {
$0.appTelemetry.send = { @Sendable signal in
signals.withValue { $0.append(signal) }
Expand Down Expand Up @@ -189,8 +193,10 @@ final class AppTelemetryReducerTests: XCTestCase {
}
let signals = LockIsolated<[AppTelemetrySignal]>([])
let store = TestStore(initialState: ExampleReducer.State()) {
ExampleReducer()
AppTelemetryReducer()
CombineReducers {
ExampleReducer()
AppTelemetryReducer()
}
} withDependencies: {
$0.appTelemetry.send = { @Sendable signal in
signals.withValue { $0.append(signal) }
Expand Down Expand Up @@ -233,8 +239,10 @@ final class AppTelemetryReducerTests: XCTestCase {
}
let signals = LockIsolated<[AppTelemetrySignal]>([])
let store = TestStore(initialState: ExampleReducer.State()) {
ExampleReducer()
AppTelemetryReducer()
CombineReducers {
ExampleReducer()
AppTelemetryReducer()
}
} withDependencies: {
$0.appTelemetry.send = { @Sendable signal in
signals.withValue { $0.append(signal) }
Expand Down Expand Up @@ -280,8 +288,10 @@ final class AppTelemetryReducerTests: XCTestCase {
}
let signals = LockIsolated<[AppTelemetrySignal]>([])
let store = TestStore(initialState: ExampleReducer.State()) {
ExampleReducer()
AppTelemetryReducer()
CombineReducers {
ExampleReducer()
AppTelemetryReducer()
}
} withDependencies: {
$0.appTelemetry.send = { @Sendable signal in
signals.withValue { $0.append(signal) }
Expand Down Expand Up @@ -319,8 +329,10 @@ final class AppTelemetryReducerTests: XCTestCase {
}
let signals = LockIsolated<[AppTelemetrySignal]>([])
let store = TestStore(initialState: ExampleReducer.State()) {
ExampleReducer()
AppTelemetryReducer()
CombineReducers {
ExampleReducer()
AppTelemetryReducer()
}
} withDependencies: {
$0.appTelemetry.send = { @Sendable signal in
signals.withValue { $0.append(signal) }
Expand Down Expand Up @@ -371,9 +383,11 @@ final class AppTelemetryReducerTests: XCTestCase {
let store = TestStore(initialState: ExampleReducer.State(
isTelemetryEnabled: false
)) {
ExampleReducer()
AppTelemetryReducer { state, _ in
state.isTelemetryEnabled
CombineReducers {
ExampleReducer()
AppTelemetryReducer { state, _ in
state.isTelemetryEnabled
}
}
} withDependencies: {
$0.appTelemetry.send = { @Sendable signal in
Expand Down Expand Up @@ -425,11 +439,13 @@ final class AppTelemetryReducerTests: XCTestCase {
}
let signals = LockIsolated<[AppTelemetrySignal]>([])
let store = TestStore(initialState: ExampleReducer.State()) {
ExampleReducer()
AppTelemetryReducer { _, action in
switch action {
case .includedAction: true
case .excludedAction: false
CombineReducers {
ExampleReducer()
AppTelemetryReducer { _, action in
switch action {
case .includedAction: true
case .excludedAction: false
}
}
}
} withDependencies: {
Expand Down

0 comments on commit 39272e1

Please sign in to comment.