Skip to content

Commit 1ba958e

Browse files
committed
add call count assertion
1 parent c418353 commit 1ba958e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Tests/Unit/InstallationUnitTests.m

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ - (void)testInstallationObjectIdCannotBeChanged {
2929
PFAssertThrowsInvalidArgumentException(installation[@"objectId"] = @"abc");
3030
}
3131

32-
- (void)testReSaveInstallation {
33-
32+
- (void)testObjectNotFoundWhenSave {
33+
#if TARGET_OS_IOS
3434
// enable LDS
3535
[[Parse _currentManager]loadOfflineStoreWithOptions:0];
3636

@@ -46,11 +46,18 @@ - (void)testReSaveInstallation {
4646

4747
BFTask *mockedTask = [BFTask taskWithError:[NSError errorWithDomain:@"" code:kPFErrorObjectNotFound userInfo:nil]];
4848

49-
OCMStub([commandRunner runCommandAsync:[OCMArg any] withOptions:PFCommandRunningOptionRetryIfFailed]).andReturn(mockedTask);
49+
__block int callCount = 0;
50+
OCMStub([commandRunner runCommandAsync:[OCMArg any] withOptions:PFCommandRunningOptionRetryIfFailed])
51+
.andReturn(mockedTask)
52+
.andDo(^(NSInvocation *invocation) {
53+
callCount++;
54+
});
5055

5156
installation.deviceToken = @"11433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306";
5257
[installation save];
5358
OCMVerifyAll(commandRunner);
59+
XCTAssertEqual(2, callCount);
60+
#endif
5461
}
5562

5663
- (void)testInstallationImmutableFieldsCannotBeChanged {

0 commit comments

Comments
 (0)