Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Parse/Parse.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ + (void)initialize {
///--------------------------------------

+ (void)setApplicationId:(NSString *)applicationId clientKey:(NSString *)clientKey {
// TODO: (nlutsenko) Add assert and unit test here that checks applicationId, clientKey not being nil.

PFConsistencyAssert([applicationId length], @"'applicationId' should not be nil.");
PFConsistencyAssert([clientKey length], @"'clientKey' should not be nil.");

// Setup new manager first, so it's 100% ready whenever someone sends a request for anything.
ParseManager *manager = [[ParseManager alloc] initWithApplicationId:applicationId clientKey:clientKey];
[manager configureWithApplicationGroupIdentifier:applicationGroupIdentifier_
Expand Down
8 changes: 8 additions & 0 deletions Tests/Unit/ParseSetupUnitTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,12 @@ - (void)testInitializeWithLDSAfterInitializeShouldThrowException {
[Parse setApplicationId:@"a" clientKey:@"b"];
PFAssertThrowsInconsistencyException([Parse enableLocalDatastore]);
}

- (void)testInitializeWithNilApplicationIdNilClientKeyShouldThrowException {
NSString *yolo = nil;
PFAssertThrowsInconsistencyException([Parse setApplicationId:yolo clientKey:yolo]);
PFAssertThrowsInconsistencyException([Parse setApplicationId:yolo clientKey:@"a"]);
PFAssertThrowsInconsistencyException([Parse setApplicationId:@"a" clientKey:yolo]);
}

@end