Skip to content

Commit 49a0699

Browse files
committed
Fixes flaky test
1 parent f1b6cdf commit 49a0699

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Parse/Tests/Unit/URLSessionCommandRunnerTests.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ - (void)testLocalIdResolutionWithArrayAndMutlipleErrors {
302302
}
303303

304304
- (void)testLocalIdResolutionWithOperations {
305+
NSArray *possibleErrors = @[@"Tried to save an object with a pointer to a new, unsaved object.",
306+
@"Tried to resolve a localId for an object with no localId."];
305307
NSError *error;
306308
PFObject *objectWithLocalId = [PFObject objectWithoutDataWithClassName:@"Yolo" localId:@"localId"];
307309
PFObject *object = [PFObject objectWithClassName:@"Yolo"];
@@ -310,7 +312,7 @@ - (void)testLocalIdResolutionWithOperations {
310312
[command resolveLocalIds:&error];
311313
XCTAssertNotNil(error);
312314
XCTAssertEqualObjects(error.domain, PFParseErrorDomain);
313-
XCTAssertEqualObjects(error.localizedDescription, @"Tried to save an object with a pointer to a new, unsaved object.");
315+
XCTAssertTrue([possibleErrors indexOfObject:error.localizedDescription] != NSNotFound);
314316

315317
error = nil;
316318

@@ -319,14 +321,16 @@ - (void)testLocalIdResolutionWithOperations {
319321
[command resolveLocalIds:&error];
320322
XCTAssertNotNil(error);
321323
XCTAssertEqualObjects(error.domain, PFParseErrorDomain);
322-
XCTAssertEqualObjects(error.localizedDescription, @"Tried to save an object with a pointer to a new, unsaved object.");
324+
XCTAssertTrue([possibleErrors indexOfObject:error.localizedDescription] != NSNotFound);
325+
326+
error = nil;
323327

324328
PFRemoveOperation *removeOperation = [PFRemoveOperation removeWithObjects:@[objectWithLocalId, object]];
325329
command = [PFRESTCommand commandWithHTTPPath:@"" httpMethod:@"" parameters:@{@"values":removeOperation} sessionToken:nil error:nil];
326330
[command resolveLocalIds:&error];
327331
XCTAssertNotNil(error);
328332
XCTAssertEqualObjects(error.domain, PFParseErrorDomain);
329-
XCTAssertEqualObjects(error.localizedDescription, @"Tried to save an object with a pointer to a new, unsaved object.");
333+
XCTAssertTrue([possibleErrors indexOfObject:error.localizedDescription] != NSNotFound);
330334
}
331335

332336
@end

0 commit comments

Comments
 (0)