Skip to content

Commit 792844e

Browse files
committed
verify offline store operations
1 parent cdc9e2d commit 792844e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Tests/Unit/InstallationUnitTests.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ - (void)testObjectNotFoundWhenSave {
3333
#if TARGET_OS_IOS
3434
// enable LDS
3535
[[Parse _currentManager]loadOfflineStoreWithOptions:0];
36+
PFOfflineStore *offlineStoreSpy = PFPartialMock([Parse _currentManager].offlineStore);
37+
[Parse _currentManager].offlineStore = offlineStoreSpy;
3638

3739
// create and save installation
3840
PFInstallation *installation = [PFInstallation currentInstallation];
@@ -44,7 +46,7 @@ - (void)testObjectNotFoundWhenSave {
4446
id commandRunner = PFStrictProtocolMock(@protocol(PFCommandRunning));
4547
[Parse _currentManager].commandRunner = commandRunner;
4648

47-
BFTask *mockedTask = [BFTask taskWithError:[NSError errorWithDomain:@"" code:kPFErrorObjectNotFound userInfo:nil]];
49+
BFTask *mockedTask = [BFTask taskWithError:[NSError errorWithDomain:@"Object Not Found" code:kPFErrorObjectNotFound userInfo:nil]];
4850

4951
__block int callCount = 0;
5052
OCMStub([commandRunner runCommandAsync:[OCMArg any] withOptions:PFCommandRunningOptionRetryIfFailed])
@@ -57,6 +59,8 @@ - (void)testObjectNotFoundWhenSave {
5759
[installation save];
5860
OCMVerifyAll(commandRunner);
5961
XCTAssertEqual(2, callCount);
62+
OCMVerify([offlineStoreSpy updateObjectIdForObject:installation oldObjectId:nil newObjectId:@"abc"]);
63+
OCMVerify([offlineStoreSpy updateObjectIdForObject:installation oldObjectId:@"abc" newObjectId:nil]);
6064
#endif
6165
}
6266

0 commit comments

Comments
 (0)