Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
square-tomb committed Jun 22, 2023
1 parent 713087b commit c26ca84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
1 change: 1 addition & 0 deletions Development.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Pod::Spec.new do |s|
test_spec.dependency 'BackStackContainer'
test_spec.dependency 'ModalContainer'
test_spec.dependency 'AlertContainer'
test_spec.dependency 'WorkflowSwiftUI'
test_spec.requires_app_host = true
test_spec.app_host_name = 'Development/SampleTicTacToe'
test_spec.source_files = 'Samples/TicTacToe/Tests/**/*.swift'
Expand Down
24 changes: 8 additions & 16 deletions Samples/TicTacToe/Tests/AuthenticationWorkflowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,10 @@ class AuthenticationWorkflowTests: XCTestCase {
.expectWorkflow(
type: LoginWorkflow.self,
producingRendering: LoginScreen(
actionSink: .noop(),
title: "",
email: "",
onEmailChanged: { _ in },
password: "",
onPasswordChanged: { _ in },
onLoginTapped: {}
password: ""
)
)
.render { screen in
Expand All @@ -210,12 +208,10 @@ class AuthenticationWorkflowTests: XCTestCase {
.expectWorkflow(
type: LoginWorkflow.self,
producingRendering: LoginScreen(
actionSink: .noop(),
title: "",
email: "",
onEmailChanged: { _ in },
password: "",
onPasswordChanged: { _ in },
onLoginTapped: {}
password: ""
)
)
.expect(
Expand Down Expand Up @@ -244,12 +240,10 @@ class AuthenticationWorkflowTests: XCTestCase {
.expectWorkflow(
type: LoginWorkflow.self,
producingRendering: LoginScreen(
actionSink: .noop(),
title: "",
email: "",
onEmailChanged: { _ in },
password: "",
onPasswordChanged: { _ in },
onLoginTapped: {}
password: ""
)
)
.expect(
Expand All @@ -275,12 +269,10 @@ class AuthenticationWorkflowTests: XCTestCase {
.expectWorkflow(
type: LoginWorkflow.self,
producingRendering: LoginScreen(
actionSink: .noop(),
title: "",
email: "",
onEmailChanged: { _ in },
password: "",
onPasswordChanged: { _ in },
onLoginTapped: {}
password: ""
)
)
.render { screen in
Expand Down
4 changes: 4 additions & 0 deletions WorkflowSwiftUI/Sources/ObservableValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public struct ScreenActionSink<Value>: Equatable {
self.sink = sink
}

public static func noop<T>() -> ScreenActionSink<T> {
ScreenActionSink<T>(Sink { _ in })
}

public func send(_ value: Value) {
sink.send(value)
}
Expand Down

0 comments on commit c26ca84

Please sign in to comment.