Skip to content

[feat]: adopt swift-custom-dump in some testing utilities #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
"version" : "1.1.4"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "82645ec760917961cfa08c9c0c7104a57a0fa4b1",
"version" : "1.3.3"
}
},
{
"identity" : "swift-identified-collections",
"kind" : "remoteSourceControl",
Expand Down
6 changes: 5 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-identified-collections", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-macro-testing", from: "0.4.0"),
.package(url: "https://github.com/pointfreeco/swift-perception", from: "1.1.4"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.2.1"),
],
targets: [
// MARK: Workflow
Expand All @@ -80,7 +81,10 @@ let package = Package(
),
.target(
name: "WorkflowTesting",
dependencies: ["Workflow"],
dependencies: [
"Workflow",
.product(name: "CustomDump", package: "swift-custom-dump"),
],
path: "WorkflowTesting/Sources",
linkerSettings: [.linkedFramework("XCTest")]
),
Expand Down
6 changes: 5 additions & 1 deletion Samples/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ let project = Project(
.unitTest(
for: "WorkflowReactiveSwift",
sources: "../WorkflowReactiveSwift/Tests/**",
dependencies: [.external(name: "WorkflowReactiveSwift")]
dependencies: [
.external(name: "WorkflowReactiveSwift"),
.external(name: "WorkflowReactiveSwiftTesting"),
]
),
.unitTest(
for: "WorkflowReactiveSwiftTesting",
Expand All @@ -205,6 +208,7 @@ let project = Project(
sources: "../WorkflowRxSwift/Tests/**",
dependencies: [
.external(name: "WorkflowRxSwift"),
.external(name: "WorkflowRxSwiftTesting"),
.external(name: "WorkflowReactiveSwift"),
]
),
Expand Down
9 changes: 9 additions & 0 deletions Samples/Tuist/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
"version" : "1.1.2"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "82645ec760917961cfa08c9c0c7104a57a0fa4b1",
"version" : "1.3.3"
}
},
{
"identity" : "swift-identified-collections",
"kind" : "remoteSourceControl",
Expand Down
9 changes: 8 additions & 1 deletion WorkflowTesting/Sources/RenderTesterResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import CustomDump
import Workflow
import XCTest

Expand Down Expand Up @@ -135,7 +136,13 @@
) rethrows -> RenderTesterResult<WorkflowType> {
var initialState = initialState
try modifications(&initialState)
XCTAssertEqual(state, initialState, "Expected state does not match", file: file, line: line)
XCTAssertNoDifference(

Check warning on line 139 in WorkflowTesting/Sources/RenderTesterResult.swift

View workflow job for this annotation

GitHub Actions / development-tests (UnitTests)

'XCTAssertNoDifference(_:_:_:file:line:)' is deprecated: renamed to 'expectNoDifference'

Check warning on line 139 in WorkflowTesting/Sources/RenderTesterResult.swift

View workflow job for this annotation

GitHub Actions / tutorial

'XCTAssertNoDifference(_:_:_:file:line:)' is deprecated: renamed to 'expectNoDifference'
initialState,
state,
"Expected state does not match",
file: file,
line: line
)
return self
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ final class WorkflowRenderTesterFailureTests: XCTestCase {
}
}

func test_assertState() {
func test_assertStateModifications() {
let result = TestWorkflow()
.renderTester(initialState: .idle)
.render { _ in }
Expand Down
Loading