@@ -34,7 +34,7 @@ @implementation IterableAPITests
34
34
- (void )setUp {
35
35
[super setUp ];
36
36
37
- [IterableAPI initializeWithApiKey: @" " ];
37
+ [IterableAPIInternal initializeWithApiKey: @" " ];
38
38
}
39
39
40
40
- (void )tearDown {
@@ -43,8 +43,8 @@ - (void)tearDown {
43
43
}
44
44
45
45
- (void )testPushServicePlatformToString {
46
- XCTAssertEqualObjects (@" APNS" , [IterableAPI pushServicePlatformToString: APNS]);
47
- XCTAssertEqualObjects (@" APNS_SANDBOX" , [IterableAPI pushServicePlatformToString: APNS_SANDBOX]);
46
+ XCTAssertEqualObjects (@" APNS" , [IterableAPIInternal pushServicePlatformToString: APNS]);
47
+ XCTAssertEqualObjects (@" APNS_SANDBOX" , [IterableAPIInternal pushServicePlatformToString: APNS_SANDBOX]);
48
48
}
49
49
50
50
- (void )testDictToJson {
@@ -65,7 +65,7 @@ - (void)testDictToJson {
65
65
}
66
66
}
67
67
};
68
- NSString *result = [IterableAPI dictToJson: args];
68
+ NSString *result = [IterableAPIInternal dictToJson: args];
69
69
NSData *data = [result dataUsingEncoding: NSUTF8StringEncoding];
70
70
id json = [NSJSONSerialization JSONObjectWithData: data options: 0 error: nil ];
71
71
XCTAssertEqualObjects (args, json);
@@ -81,12 +81,12 @@ - (void)testDictToJson {
81
81
}
82
82
83
83
- (void )testUserInterfaceIdionEnumToString {
84
- XCTAssertEqualObjects (@" Phone" , [IterableAPI userInterfaceIdiomEnumToString: UIUserInterfaceIdiomPhone]);
85
- XCTAssertEqualObjects (@" Pad" , [IterableAPI userInterfaceIdiomEnumToString: UIUserInterfaceIdiomPad]);
84
+ XCTAssertEqualObjects (@" Phone" , [IterableAPIInternal userInterfaceIdiomEnumToString: UIUserInterfaceIdiomPhone]);
85
+ XCTAssertEqualObjects (@" Pad" , [IterableAPIInternal userInterfaceIdiomEnumToString: UIUserInterfaceIdiomPad]);
86
86
// we don't care about TVs for now
87
- XCTAssertEqualObjects (@" Unspecified" , [IterableAPI userInterfaceIdiomEnumToString: UIUserInterfaceIdiomTV]);
88
- XCTAssertEqualObjects (@" Unspecified" , [IterableAPI userInterfaceIdiomEnumToString: UIUserInterfaceIdiomUnspecified]);
89
- XCTAssertEqualObjects (@" Unspecified" , [IterableAPI userInterfaceIdiomEnumToString: 192387 ]);
87
+ XCTAssertEqualObjects (@" Unspecified" , [IterableAPIInternal userInterfaceIdiomEnumToString: UIUserInterfaceIdiomTV]);
88
+ XCTAssertEqualObjects (@" Unspecified" , [IterableAPIInternal userInterfaceIdiomEnumToString: UIUserInterfaceIdiomUnspecified]);
89
+ XCTAssertEqualObjects (@" Unspecified" , [IterableAPIInternal userInterfaceIdiomEnumToString: 192387 ]);
90
90
}
91
91
92
92
- (void )testUniversalDeeplinkRewrite {
@@ -97,7 +97,7 @@ - (void)testUniversalDeeplinkRewrite {
97
97
XCTAssertTrue (NSThread .isMainThread );
98
98
[expectation fulfill ];
99
99
};
100
- [IterableAPI getAndTrackDeeplink: iterableLink callbackBlock: aBlock];
100
+ [IterableAPIInternal getAndTrackDeeplink: iterableLink callbackBlock: aBlock];
101
101
102
102
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
103
103
}
@@ -109,7 +109,7 @@ - (void)testUniversalDeeplinkNoRewrite {
109
109
XCTAssertEqualObjects (iterableNoRewriteURL, redirectUrl);
110
110
[expectation fulfill ];
111
111
};
112
- [IterableAPI getAndTrackDeeplink: normalLink callbackBlock: uBlock];
112
+ [IterableAPIInternal getAndTrackDeeplink: normalLink callbackBlock: uBlock];
113
113
114
114
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
115
115
}
@@ -126,9 +126,9 @@ - (void)testHandleUniversalLinkRewrite {
126
126
127
127
IterableConfig *config = [[IterableConfig alloc ] init ];
128
128
config.urlDelegate = urlDelegateMock;
129
- [IterableAPI initializeWithApiKey: @" " config: config];
129
+ [IterableAPIInternal initializeWithApiKey: @" " config: config];
130
130
NSURL *iterableLink = [NSURL URLWithString: iterableRewriteURL];
131
- [IterableAPI handleUniversalLink: iterableLink];
131
+ [IterableAPIInternal handleUniversalLink: iterableLink];
132
132
133
133
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
134
134
}
@@ -141,12 +141,12 @@ - (void)testDeeplinkAttributionInfo {
141
141
XCTestExpectation *expectation = [self expectationWithDescription: @" High Expectations" ];
142
142
NSURL *normalLink = [NSURL URLWithString: iterableRewriteURL];
143
143
ITEActionBlock uBlock = ^(NSString * redirectUrl) {
144
- XCTAssertEqualObjects (IterableAPI .sharedInstance .attributionInfo .campaignId , campaignId);
145
- XCTAssertEqualObjects (IterableAPI .sharedInstance .attributionInfo .templateId , templateId);
146
- XCTAssertEqualObjects (IterableAPI .sharedInstance .attributionInfo .messageId , messageId);
144
+ XCTAssertEqualObjects (IterableAPIInternal .sharedInstance .attributionInfo .campaignId , campaignId);
145
+ XCTAssertEqualObjects (IterableAPIInternal .sharedInstance .attributionInfo .templateId , templateId);
146
+ XCTAssertEqualObjects (IterableAPIInternal .sharedInstance .attributionInfo .messageId , messageId);
147
147
[expectation fulfill ];
148
148
};
149
- [IterableAPI getAndTrackDeeplink: normalLink callbackBlock: uBlock];
149
+ [IterableAPIInternal getAndTrackDeeplink: normalLink callbackBlock: uBlock];
150
150
151
151
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
152
152
}
@@ -159,7 +159,7 @@ - (void)testNoURLRedirect {
159
159
XCTAssertNotEqual (exampleUrl, redirectUrl);
160
160
XCTAssertEqualObjects (redirectRequest, redirectUrl);
161
161
};
162
- [IterableAPI getAndTrackDeeplink: redirectLink callbackBlock: redirectBlock];
162
+ [IterableAPIInternal getAndTrackDeeplink: redirectLink callbackBlock: redirectBlock];
163
163
164
164
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
165
165
}
@@ -172,7 +172,7 @@ - (void)testUniversalDeeplinkHttp {
172
172
XCTAssertEqualObjects (googleHttps, redirectUrl);
173
173
XCTAssertNotEqual (googleHttp, redirectUrl);
174
174
};
175
- [IterableAPI getAndTrackDeeplink: googleHttpLink callbackBlock: googleHttpBlock];
175
+ [IterableAPIInternal getAndTrackDeeplink: googleHttpLink callbackBlock: googleHttpBlock];
176
176
177
177
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
178
178
}
@@ -186,13 +186,13 @@ - (void)testUniversalDeeplinkHttps {
186
186
[expectation fulfill ];
187
187
XCTAssertEqualObjects (googleHttps, redirectUrl);
188
188
};
189
- [IterableAPI getAndTrackDeeplink: googleHttpsLink callbackBlock: googleHttpsBlock];
189
+ [IterableAPIInternal getAndTrackDeeplink: googleHttpsLink callbackBlock: googleHttpsBlock];
190
190
191
191
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
192
192
}
193
193
194
194
- (void )testURLQueryParamRewrite {
195
- [IterableAPI initializeWithApiKey: @" " ];
195
+ [IterableAPIInternal initializeWithApiKey: @" " ];
196
196
197
197
NSCharacterSet * set = [NSCharacterSet URLQueryAllowedCharacterSet ];
198
198
@@ -211,19 +211,19 @@ - (void)testURLQueryParamRewrite {
211
211
}
212
212
213
213
// Test full set of possible URLQueryAllowedCharacterSet characters
214
- NSString * encodedSet = [[IterableAPI sharedInstance ] encodeURLParam: strSet];
214
+ NSString * encodedSet = [[IterableAPIInternal sharedInstance ] encodeURLParam: strSet];
215
215
XCTAssertNotEqual (encodedSet, strSet);
216
216
XCTAssert ([encodedSet isEqualToString: @" !$&'()*%2B,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~" ]);
217
217
218
- NSString * encoded = [[
IterableAPI sharedInstance ]
encodeURLParam: @" [email protected] " ];
218
+ NSString * encoded = [[
IterableAPIInternal sharedInstance ]
encodeURLParam: @" [email protected] " ];
219
219
XCTAssertNotEqual (encoded,
@" [email protected] " );
220
220
XCTAssert ([encoded
isEqualToString: @" you%[email protected] " ]);
221
221
222
- NSString * emptySet = [[IterableAPI sharedInstance ] encodeURLParam: @" " ];
222
+ NSString * emptySet = [[IterableAPIInternal sharedInstance ] encodeURLParam: @" " ];
223
223
XCTAssertEqual (emptySet, @" " );
224
224
XCTAssert ([emptySet isEqualToString: @" " ]);
225
225
226
- NSString * nilSet = [[IterableAPI sharedInstance ] encodeURLParam: nil ];
226
+ NSString * nilSet = [[IterableAPIInternal sharedInstance ] encodeURLParam: nil ];
227
227
XCTAssertEqualObjects (nilSet, nil );
228
228
}
229
229
@@ -245,27 +245,27 @@ - (void)testRegisterToken {
245
245
246
246
IterableConfig *config = [[IterableConfig alloc ] init ];
247
247
config.pushIntegrationName = @" pushIntegration" ;
248
- [IterableAPI initializeWithApiKey: @" apiKey" config: config];
249
- [[
IterableAPI sharedInstance ]
setEmail: @" [email protected] " ];
250
- [[IterableAPI sharedInstance ] registerToken: [@" token" dataUsingEncoding: kCFStringEncodingUTF8 ]];
248
+ [IterableAPIInternal initializeWithApiKey: @" apiKey" config: config];
249
+ [[
IterableAPIInternal sharedInstance ]
setEmail: @" [email protected] " ];
250
+ [[IterableAPIInternal sharedInstance ] registerToken: [@" token" dataUsingEncoding: kCFStringEncodingUTF8 ]];
251
251
252
252
[self waitForExpectations: @[expectation] timeout: 5.0 ];
253
253
[OHHTTPStubs removeAllStubs ];
254
254
}
255
255
256
256
- (void )testEmailUserIdPersistence {
257
- [IterableAPI initializeWithApiKey: @" apiKey" ];
258
- [[
IterableAPI sharedInstance ]
setEmail: @" [email protected] " ];
257
+ [IterableAPIInternal initializeWithApiKey: @" apiKey" ];
258
+ [[
IterableAPIInternal sharedInstance ]
setEmail: @" [email protected] " ];
259
259
260
- [IterableAPI initializeWithApiKey: @" apiKey" ];
261
- XCTAssertEqualObjects ([
IterableAPI sharedInstance ].
email ,
@" [email protected] " );
262
- XCTAssertNil ([IterableAPI sharedInstance ].userId );
260
+ [IterableAPIInternal initializeWithApiKey: @" apiKey" ];
261
+ XCTAssertEqualObjects ([
IterableAPIInternal sharedInstance ].
email ,
@" [email protected] " );
262
+ XCTAssertNil ([IterableAPIInternal sharedInstance ].userId );
263
263
264
- [[IterableAPI sharedInstance ] setUserId: @" testUserId" ];
264
+ [[IterableAPIInternal sharedInstance ] setUserId: @" testUserId" ];
265
265
266
- [IterableAPI initializeWithApiKey: @" apiKey" ];
267
- XCTAssertEqualObjects ([IterableAPI sharedInstance ].userId , @" testUserId" );
268
- XCTAssertNil ([IterableAPI sharedInstance ].email );
266
+ [IterableAPIInternal initializeWithApiKey: @" apiKey" ];
267
+ XCTAssertEqualObjects ([IterableAPIInternal sharedInstance ].userId , @" testUserId" );
268
+ XCTAssertNil ([IterableAPIInternal sharedInstance ].email );
269
269
}
270
270
271
271
0 commit comments