Skip to content

Commit

Permalink
properly handle config
Browse files Browse the repository at this point in the history
  • Loading branch information
dplewis committed Nov 7, 2024
1 parent b8966d0 commit 2ade033
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions Parse/Parse/Source/Parse.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ + (void)initializeWithConfigurationAllowingReinitialize:(ParseClientConfiguratio
[manager startManaging];

currentParseManager_ = manager;
currentParseConfiguration_ = configuration;

#if TARGET_OS_IOS
[PFNetworkActivityIndicatorManager sharedManager].enabled = YES;
Expand Down
23 changes: 23 additions & 0 deletions Parse/Tests/Unit/ParseClientConfigurationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@import Foundation;

#import "PFTestCase.h"
#import "Parse_Private.h"
#import "ParseClientConfiguration.h"
#import "ParseClientConfiguration_Private.h"
#import "PFExtensionDataSharingTestHelper.h"
Expand Down Expand Up @@ -145,4 +146,26 @@ - (void)testServerValidation {
}];
}

- (void)testSetServerURL {
ParseClientConfiguration *config = [ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
configuration.applicationId = @"foo";
configuration.clientKey = @"bar";
configuration.server = @"http://localhost";
configuration.localDatastoreEnabled = YES;
configuration.networkRetryAttempts = 1337;
}];

[Parse initializeWithConfiguration:config];

XCTAssertEqualObjects(config.server, @"http://localhost");
XCTAssertEqualObjects(config.server, [Parse server]);

[Parse setServer:@"http://example.org"];
XCTAssertEqualObjects([Parse server], @"http://example.org");

// Should get server from current config instead of manager
[Parse _clearCurrentManager];
XCTAssertEqualObjects([Parse server], @"http://example.org");
}

@end

0 comments on commit 2ade033

Please sign in to comment.