-
Notifications
You must be signed in to change notification settings - Fork 17
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
Conversation
…ros. Improved failure messages as well.
…t that wasn't useful - test_BackendServiceProtocol_Execute().
XCTAssertFalse(lhs == rhs) | ||
} | ||
|
||
func test_BackendServiceProtocol_Execute() { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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. ¯_(ツ)_/¯
There was a problem hiding this comment.
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 Report
@@ 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
Continue to review full report at Codecov.
|
General unit test organization and cleanup.