-
Notifications
You must be signed in to change notification settings - Fork 191
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
[Pair] Present request when reparing #1040
Conversation
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.
LGTM
guard !hasPairing(for: uri.topic) else { | ||
throw Errors.pairingAlreadyExist(topic: uri.topic) | ||
guard try !pairingHasPendingRequest(for: uri.topic) else { | ||
return |
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.
why it's not throws anymore?
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.
with throwing error we can easily test this check
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.
It will throw when try !pairingHasPendingRequest
is called instead
func hasPairing(for topic: String) -> Bool { | ||
if let pairing = pairingStorage.getPairing(forTopic: topic) { | ||
return pairing.requestReceived | ||
func pairingHasPendingRequest(for topic: String) throws -> Bool { |
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.
do we need unit test for this method?
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.
Tested in the method testPairOnSameUriPresentsRequest()
@flypaper0 @llbartekll the PR is on hold, need to clarify some questions |
# Conflicts: # Example/IntegrationTests/Pairing/PairingTests.swift # Example/IntegrationTests/Push/PushTests.swift
1.mp4
Due Dilligence