Skip to content

Conversation

@swwol
Copy link
Contributor

@swwol swwol commented Jul 25, 2019

No description provided.

@swwol swwol requested review from timsearle and wainglaister July 25, 2019 15:06
@codecov
Copy link

codecov bot commented Jul 25, 2019

Codecov Report

Merging #4 into develop will decrease coverage by 0.27%.
The diff coverage is 92.3%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop       #4      +/-   ##
===========================================
- Coverage       99%   98.72%   -0.28%     
===========================================
  Files           32       32              
  Lines          900      939      +39     
===========================================
+ Hits           891      927      +36     
- Misses           9       12       +3
Impacted Files Coverage Δ
Sources/Webservice/Requests/RequestBehavior.swift 100% <100%> (ø) ⬆️
Sources/Webservice/Webservice.swift 100% <100%> (ø) ⬆️
NetworkingTests/Webservice/WebserviceTests.swift 94.59% <89.28%> (-0.95%) ⬇️

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 e999455...d05dfb3. Read the comment docs.

case .cancelled:
break
default:
XCTFail("wrong error returned")
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be rewritten to increase code coverage by testing the success criteria, not putting fails all over the place just-in-case

}
}

func testCancelledBehavior() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the test for a cancel request behaviour that returns true?

webservice.load(resource) { result in
switch result {
case .failure(let error):
if let error = error as? Webservice.Error {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is incorrect, the requirement, as i understand it from discussion, is to not call the completion block when cancelled (but to call the other behaviours to let them know of the cancellation)

}

func allowCompletion(data: Data?, response: URLResponse?, error: Error?) -> Bool {
return !behaviors.map { $0.allowCompletion(data: data, response: response, error: error) }.contains(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

this can be more efficient, if any return false there is no point processing more

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this is valid. We don't know what it is in the other behaviours and whether they know about this implementation detail. We also didn't discuss if one behaviour returns true and one returns false, what should we do? E.g. a logging behaviour.

@mikezs mikezs added this to the 1.0.2 milestone Oct 19, 2020
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