Skip to content
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

Feature/unit test cleanup #22

Merged
merged 6 commits into from
Mar 26, 2018
Merged

Feature/unit test cleanup #22

merged 6 commits into from
Mar 26, 2018

Conversation

tylermilner
Copy link
Contributor

General unit test organization and cleanup.

XCTAssertFalse(lhs == rhs)
}

func test_BackendServiceProtocol_Execute() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up removing this test since it didn't actually test anything and it didn't appear to actually affect code coverage after removal.

@@ -161,11 +161,10 @@ class NetworkServiceTests: XCTestCase {
let asyncExpectation = expectation(description: "\(NetworkService.self) completion")

service.execute(request: defaultRequest) { (result) in
XCTAssertTrue(result == expectedResult, file: file, line: line)
XCTAssertTrue(result == expectedResult, "Result '\(result)' did not equal expected result '\(expectedResult)'", file: file, line: line)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I unfortunately wasn't able to convert this to an XCTAssertEqual(...) so I added some error messaging instead. I tried

XCTAssertEqual(result as Result<NetworkServiceSuccess, NetworkServiceFailure>, expectedResult)

and

XCTAssertEqual(result, expectedResult as NetworkServiceResult)

but had no luck. It's weird because the compiler seems to think they're different types, but the error message it emits lists them as being the same type. ¯_(ツ)_/¯

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding in the explicit output should be a good enough stopgap, in my opinion.

@codecov-io
Copy link

codecov-io commented Mar 26, 2018

Codecov Report

Merging #22 into develop will decrease coverage by 0.25%.
The diff coverage is 78.84%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #22      +/-   ##
===========================================
- Coverage    94.14%   93.88%   -0.26%     
===========================================
  Files           26       26              
  Lines          990      981       -9     
  Branches        46       46              
===========================================
- Hits           932      921      -11     
- Misses          56       58       +2     
  Partials         2        2
Impacted Files Coverage Δ
Tests/NetworkSessionTest.swift 83.33% <0%> (-2.39%) ⬇️
Tests/NetworkServiceTests.swift 99.2% <0%> (-0.8%) ⬇️
Tests/BackendServiceTests.swift 97.59% <100%> (+0.96%) ⬆️
Tests/HTTPTests.swift 86.66% <78.04%> (ø)
Tests/Helper/Mocks/MockBackendService.swift 0% <0%> (-33.34%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df347e3...0fe4ea0. Read the comment docs.

@wmcginty wmcginty merged commit c87b938 into develop Mar 26, 2018
@wmcginty wmcginty deleted the feature/unitTestCleanup branch March 26, 2018 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants