-
Notifications
You must be signed in to change notification settings - Fork 26
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
Push Channels tests #708
Push Channels tests #708
Conversation
4d514d0
to
3fe9980
Compare
6567d54
to
3981416
Compare
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.
Some comments and requested changes.
- (void)listSubscriptions:(void(^)(ARTPaginatedResult<ARTPushChannelSubscription *> *_Nullable, ARTErrorInfo *_Nullable))callback { | ||
[self listSubscriptions:nil callback:callback]; | ||
} | ||
- (BOOL)listSubscriptions:(NSDictionary<NSString *, NSString *> *)params callback:(void(^)(ARTPaginatedResult<ARTPushChannelSubscription *> *_Nullable, ARTErrorInfo *_Nullable))callback error:(NSError *_Nullable *_Nullable)errorPtr { |
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.
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 has a BOOL
because it's how ObjC handle errors. We should respect that for good Swift/ObjC interoperability. An ObjC method with an NSError **
as last parameter and a BOOL return type will bridge to a Swift method that throw an error.
Source/ARTPushChannel.m
Outdated
if (!device) { | ||
- (ARTLocalDevice *)getDevice:(void(^_Nullable)(ARTErrorInfo *_Nullable))callback { | ||
ARTLocalDevice *device = [_channel device]; | ||
if (![device isRegistered]) { | ||
if (callback) callback([ARTErrorInfo createWithCode:0 message:@"cannot use device before ARTRest.push.activate has finished"]); |
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.
Not sure we should mention "ARTRest.push.activate".
I think "... before device activation has finished" is better.
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.
Accepted acd4100 👍
Spec/PushChannel.swift
Outdated
} | ||
} | ||
|
||
// RSH7a2 |
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 think this is RSH7b2
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.
Fixed 2dba0b0 👍
|
||
it("should return a paginated result with PushChannelSubscription filtered by channel and client") { | ||
let params = [ | ||
"clientId": "tester", |
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.
probably better to reuse rest.options.clientId
expect { try channel.push.listSubscriptions(params) { _, _ in } }.to(throwError { (error: NSError) in | ||
expect(error.code).to(equal(ARTDataQueryError.invalidParameters.rawValue)) | ||
}) | ||
} |
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.
Please add a test in which you actually subscribe and then you check that the result of listSubscriptions
actually includes the result of the subscription.
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.
Done 720d602 but it doesn't pass. I already reported that issue in Slack.
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.
If you put a breakpoint on this line you'll get
(lldb) po channel.name
"test-2-pushenabled:foo"
(lldb)
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.
@ricardopereira quite sure it's due to this https://github.com/ably/ably-ios/blob/push-channels/Spec/TestUtilities.swift#L100
Can you fix that please?
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.
Fixed in 02b4d05
72847f4
to
07ec07c
Compare
58633b7
to
3a7fa24
Compare
Test |
Rebased with |
@ricardopereira when you pull down this branch to run it locally it throws a bunch of compilation errors |
@funkyboy You're working with Xcode 9.3? |
@ricardopereira no, 9.2. Afair you said you didn’t upgrade any project settings. |
@funkyboy I did not update the project settings, I'm only using Xcode 9.3 #709 (comment) |
@ricardopereira Yup, the point is that it doesn’t compile on 9.2 :( |
@funkyboy I think it's not a big deal. This won't affect users because it only affects tests and even so this is still in beta, from what I know. |
@ricardopereira FYI I cherry-picked this commit 1845218 to both UPDATE: Sorry, I cherry-picked the commit ONLY to |
@ricardopereira also, there's a consistent failure on this line https://github.com/ably/ably-ios/blob/push-channels/Spec/PushActivationStateMachine.swift#L584 Likely due to the fact that the previous test doesn't have a |
Rebased on |
NOTE: this commit will be dropped when this issue has been solved #735
No description provided.