1616
1717static CGFloat const IterableNetworkResponseExpectationTimeout = 5.0 ;
1818
19- @interface IterableAPIImplementationTests : XCTestCase
19+ @interface IterableAPIInternalTests : XCTestCase
2020@end
2121
22- @implementation IterableAPIImplementationTests
22+ @implementation IterableAPIInternalTests
2323
2424NSString *redirectRequest = @" https://httpbin.org/redirect-to?url=http://example.com" ;
2525NSString *exampleUrl = @" http://example.com" ;
@@ -31,7 +31,7 @@ @implementation IterableAPIImplementationTests
3131
3232- (void )setUp {
3333 [super setUp ];
34- [IterableAPIImplementation initializeWithApiKey: @" " ];
34+ [IterableAPIInternal initializeWithApiKey: @" " ];
3535}
3636
3737- (void )tearDown {
@@ -40,8 +40,8 @@ - (void)tearDown {
4040}
4141
4242- (void )testPushServicePlatformToString {
43- XCTAssertEqualObjects (@" APNS" , [IterableAPIImplementation pushServicePlatformToString: APNS]);
44- XCTAssertEqualObjects (@" APNS_SANDBOX" , [IterableAPIImplementation pushServicePlatformToString: APNS_SANDBOX]);
43+ XCTAssertEqualObjects (@" APNS" , [IterableAPIInternal pushServicePlatformToString: APNS]);
44+ XCTAssertEqualObjects (@" APNS_SANDBOX" , [IterableAPIInternal pushServicePlatformToString: APNS_SANDBOX]);
4545}
4646
4747- (void )testDictToJson {
@@ -62,7 +62,7 @@ - (void)testDictToJson {
6262 }
6363 }
6464 };
65- NSString *result = [IterableAPIImplementation dictToJson: args];
65+ NSString *result = [IterableAPIInternal dictToJson: args];
6666 NSData *data = [result dataUsingEncoding: NSUTF8StringEncoding];
6767 id json = [NSJSONSerialization JSONObjectWithData: data options: 0 error: nil ];
6868 XCTAssertEqualObjects (args, json);
@@ -78,12 +78,12 @@ - (void)testDictToJson {
7878}
7979
8080- (void )testUserInterfaceIdionEnumToString {
81- XCTAssertEqualObjects (@" Phone" , [IterableAPIImplementation userInterfaceIdiomEnumToString: UIUserInterfaceIdiomPhone]);
82- XCTAssertEqualObjects (@" Pad" , [IterableAPIImplementation userInterfaceIdiomEnumToString: UIUserInterfaceIdiomPad]);
81+ XCTAssertEqualObjects (@" Phone" , [IterableAPIInternal userInterfaceIdiomEnumToString: UIUserInterfaceIdiomPhone]);
82+ XCTAssertEqualObjects (@" Pad" , [IterableAPIInternal userInterfaceIdiomEnumToString: UIUserInterfaceIdiomPad]);
8383 // we don't care about TVs for now
84- XCTAssertEqualObjects (@" Unspecified" , [IterableAPIImplementation userInterfaceIdiomEnumToString: UIUserInterfaceIdiomTV]);
85- XCTAssertEqualObjects (@" Unspecified" , [IterableAPIImplementation userInterfaceIdiomEnumToString: UIUserInterfaceIdiomUnspecified]);
86- XCTAssertEqualObjects (@" Unspecified" , [IterableAPIImplementation userInterfaceIdiomEnumToString: 192387 ]);
84+ XCTAssertEqualObjects (@" Unspecified" , [IterableAPIInternal userInterfaceIdiomEnumToString: UIUserInterfaceIdiomTV]);
85+ XCTAssertEqualObjects (@" Unspecified" , [IterableAPIInternal userInterfaceIdiomEnumToString: UIUserInterfaceIdiomUnspecified]);
86+ XCTAssertEqualObjects (@" Unspecified" , [IterableAPIInternal userInterfaceIdiomEnumToString: 192387 ]);
8787}
8888
8989- (void )testUniversalDeeplinkRewrite {
@@ -94,7 +94,7 @@ - (void)testUniversalDeeplinkRewrite {
9494 XCTAssertTrue (NSThread .isMainThread );
9595 [expectation fulfill ];
9696 };
97- [IterableAPIImplementation getAndTrackDeeplink: iterableLink callbackBlock: aBlock];
97+ [IterableAPIInternal getAndTrackDeeplink: iterableLink callbackBlock: aBlock];
9898
9999 [self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
100100}
@@ -106,7 +106,7 @@ - (void)testUniversalDeeplinkNoRewrite {
106106 XCTAssertEqualObjects (iterableNoRewriteURL, redirectUrl);
107107 [expectation fulfill ];
108108 };
109- [IterableAPIImplementation getAndTrackDeeplink: normalLink callbackBlock: uBlock];
109+ [IterableAPIInternal getAndTrackDeeplink: normalLink callbackBlock: uBlock];
110110
111111 [self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
112112}
@@ -123,9 +123,9 @@ - (void)testHandleUniversalLinkRewrite {
123123
124124 IterableConfig *config = [[IterableConfig alloc ] init ];
125125 config.urlDelegate = urlDelegateMock;
126- [IterableAPIImplementation initializeWithApiKey: @" " config: config];
126+ [IterableAPIInternal initializeWithApiKey: @" " config: config];
127127 NSURL *iterableLink = [NSURL URLWithString: iterableRewriteURL];
128- [IterableAPIImplementation handleUniversalLink: iterableLink];
128+ [[IterableAPIInternal sharedInstance ] handleUniversalLink: iterableLink];
129129
130130 [self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
131131}
@@ -138,12 +138,12 @@ - (void)testDeeplinkAttributionInfo {
138138 XCTestExpectation *expectation = [self expectationWithDescription: @" High Expectations" ];
139139 NSURL *normalLink = [NSURL URLWithString: iterableRewriteURL];
140140 ITEActionBlock uBlock = ^(NSString * redirectUrl) {
141- XCTAssertEqualObjects (IterableAPIImplementation .sharedInstance .attributionInfo .campaignId , campaignId);
142- XCTAssertEqualObjects (IterableAPIImplementation .sharedInstance .attributionInfo .templateId , templateId);
143- XCTAssertEqualObjects (IterableAPIImplementation .sharedInstance .attributionInfo .messageId , messageId);
141+ XCTAssertEqualObjects (IterableAPIInternal .sharedInstance .attributionInfo .campaignId , campaignId);
142+ XCTAssertEqualObjects (IterableAPIInternal .sharedInstance .attributionInfo .templateId , templateId);
143+ XCTAssertEqualObjects (IterableAPIInternal .sharedInstance .attributionInfo .messageId , messageId);
144144 [expectation fulfill ];
145145 };
146- [IterableAPIImplementation getAndTrackDeeplink: normalLink callbackBlock: uBlock];
146+ [IterableAPIInternal getAndTrackDeeplink: normalLink callbackBlock: uBlock];
147147
148148 [self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
149149}
@@ -156,7 +156,7 @@ - (void)testNoURLRedirect {
156156 XCTAssertNotEqual (exampleUrl, redirectUrl);
157157 XCTAssertEqualObjects (redirectRequest, redirectUrl);
158158 };
159- [IterableAPIImplementation getAndTrackDeeplink: redirectLink callbackBlock: redirectBlock];
159+ [IterableAPIInternal getAndTrackDeeplink: redirectLink callbackBlock: redirectBlock];
160160
161161 [self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
162162}
@@ -169,7 +169,7 @@ - (void)testUniversalDeeplinkHttp {
169169 XCTAssertEqualObjects (googleHttps, redirectUrl);
170170 XCTAssertNotEqual (googleHttp, redirectUrl);
171171 };
172- [IterableAPIImplementation getAndTrackDeeplink: googleHttpLink callbackBlock: googleHttpBlock];
172+ [IterableAPIInternal getAndTrackDeeplink: googleHttpLink callbackBlock: googleHttpBlock];
173173
174174 [self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
175175}
@@ -183,13 +183,13 @@ - (void)testUniversalDeeplinkHttps {
183183 [expectation fulfill ];
184184 XCTAssertEqualObjects (googleHttps, redirectUrl);
185185 };
186- [IterableAPIImplementation getAndTrackDeeplink: googleHttpsLink callbackBlock: googleHttpsBlock];
186+ [IterableAPIInternal getAndTrackDeeplink: googleHttpsLink callbackBlock: googleHttpsBlock];
187187
188188 [self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
189189}
190190
191191- (void )testURLQueryParamRewrite {
192- [IterableAPIImplementation initializeWithApiKey: @" " ];
192+ [IterableAPIInternal initializeWithApiKey: @" " ];
193193
194194 NSCharacterSet * set = [NSCharacterSet URLQueryAllowedCharacterSet ];
195195
@@ -208,19 +208,19 @@ - (void)testURLQueryParamRewrite {
208208 }
209209
210210 // Test full set of possible URLQueryAllowedCharacterSet characters
211- NSString * encodedSet = [[IterableAPIImplementation sharedInstance ] encodeURLParam: strSet];
211+ NSString * encodedSet = [[IterableAPIInternal sharedInstance ] encodeURLParam: strSet];
212212 XCTAssertNotEqual (encodedSet, strSet);
213213 XCTAssert ([encodedSet isEqualToString: @" !$&'()*%2B,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~" ]);
214214
215- NSString * encoded = [[IterableAPIImplementation sharedInstance ] encodeURLParam: @" you+me@iterable.com" ];
215+ NSString * encoded = [[IterableAPIInternal sharedInstance ] encodeURLParam: @" you+me@iterable.com" ];
216216 XCTAssertNotEqual (encoded, @" you+me@iterable.com" );
217217 XCTAssert ([encoded isEqualToString: @" you%2Bme@iterable.com" ]);
218218
219- NSString * emptySet = [[IterableAPIImplementation sharedInstance ] encodeURLParam: @" " ];
219+ NSString * emptySet = [[IterableAPIInternal sharedInstance ] encodeURLParam: @" " ];
220220 XCTAssertEqual (emptySet, @" " );
221221 XCTAssert ([emptySet isEqualToString: @" " ]);
222222
223- NSString * nilSet = [[IterableAPIImplementation sharedInstance ] encodeURLParam: nil ];
223+ NSString * nilSet = [[IterableAPIInternal sharedInstance ] encodeURLParam: nil ];
224224 XCTAssertEqualObjects (nilSet, nil );
225225}
226226
@@ -242,27 +242,27 @@ - (void)testRegisterToken {
242242
243243 IterableConfig *config = [[IterableConfig alloc ] init ];
244244 config.pushIntegrationName = @" pushIntegration" ;
245- [IterableAPIImplementation initializeWithApiKey: @" apiKey" config: config];
246- [[IterableAPIImplementation sharedInstance ] setEmail: @" user@example.com" ];
247- [[IterableAPIImplementation sharedInstance ] registerToken: [@" token" dataUsingEncoding: kCFStringEncodingUTF8 ]];
245+ [IterableAPIInternal initializeWithApiKey: @" apiKey" config: config];
246+ [[IterableAPIInternal sharedInstance ] setEmail: @" user@example.com" ];
247+ [[IterableAPIInternal sharedInstance ] registerToken: [@" token" dataUsingEncoding: kCFStringEncodingUTF8 ]];
248248
249249 [self waitForExpectations: @[expectation] timeout: 5.0 ];
250250 [OHHTTPStubs removeAllStubs ];
251251}
252252
253253- (void )testEmailUserIdPersistence {
254- [IterableAPIImplementation initializeWithApiKey: @" apiKey" ];
255- [[IterableAPIImplementation sharedInstance ] setEmail: @" test@email.com" ];
254+ [IterableAPIInternal initializeWithApiKey: @" apiKey" ];
255+ [[IterableAPIInternal sharedInstance ] setEmail: @" test@email.com" ];
256256
257- [IterableAPIImplementation initializeWithApiKey: @" apiKey" ];
258- XCTAssertEqualObjects ([IterableAPIImplementation sharedInstance ].email , @" test@email.com" );
259- XCTAssertNil ([IterableAPIImplementation sharedInstance ].userId );
257+ [IterableAPIInternal initializeWithApiKey: @" apiKey" ];
258+ XCTAssertEqualObjects ([IterableAPIInternal sharedInstance ].email , @" test@email.com" );
259+ XCTAssertNil ([IterableAPIInternal sharedInstance ].userId );
260260
261- [[IterableAPIImplementation sharedInstance ] setUserId: @" testUserId" ];
261+ [[IterableAPIInternal sharedInstance ] setUserId: @" testUserId" ];
262262
263- [IterableAPIImplementation initializeWithApiKey: @" apiKey" ];
264- XCTAssertEqualObjects ([IterableAPIImplementation sharedInstance ].userId , @" testUserId" );
265- XCTAssertNil ([IterableAPIImplementation sharedInstance ].email );
263+ [IterableAPIInternal initializeWithApiKey: @" apiKey" ];
264+ XCTAssertEqualObjects ([IterableAPIInternal sharedInstance ].userId , @" testUserId" );
265+ XCTAssertNil ([IterableAPIInternal sharedInstance ].email );
266266}
267267
268268
0 commit comments