16
16
17
17
static CGFloat const IterableNetworkResponseExpectationTimeout = 5.0 ;
18
18
19
- @interface IterableAPIImplementationTests : XCTestCase
19
+ @interface IterableAPIInternalTests : XCTestCase
20
20
@end
21
21
22
- @implementation IterableAPIImplementationTests
22
+ @implementation IterableAPIInternalTests
23
23
24
24
NSString *redirectRequest = @" https://httpbin.org/redirect-to?url=http://example.com" ;
25
25
NSString *exampleUrl = @" http://example.com" ;
@@ -31,7 +31,7 @@ @implementation IterableAPIImplementationTests
31
31
32
32
- (void )setUp {
33
33
[super setUp ];
34
- [IterableAPIImplementation initializeWithApiKey: @" " ];
34
+ [IterableAPIInternal initializeWithApiKey: @" " ];
35
35
}
36
36
37
37
- (void )tearDown {
@@ -40,8 +40,8 @@ - (void)tearDown {
40
40
}
41
41
42
42
- (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]);
45
45
}
46
46
47
47
- (void )testDictToJson {
@@ -62,7 +62,7 @@ - (void)testDictToJson {
62
62
}
63
63
}
64
64
};
65
- NSString *result = [IterableAPIImplementation dictToJson: args];
65
+ NSString *result = [IterableAPIInternal dictToJson: args];
66
66
NSData *data = [result dataUsingEncoding: NSUTF8StringEncoding];
67
67
id json = [NSJSONSerialization JSONObjectWithData: data options: 0 error: nil ];
68
68
XCTAssertEqualObjects (args, json);
@@ -78,12 +78,12 @@ - (void)testDictToJson {
78
78
}
79
79
80
80
- (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]);
83
83
// 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 ]);
87
87
}
88
88
89
89
- (void )testUniversalDeeplinkRewrite {
@@ -94,7 +94,7 @@ - (void)testUniversalDeeplinkRewrite {
94
94
XCTAssertTrue (NSThread .isMainThread );
95
95
[expectation fulfill ];
96
96
};
97
- [IterableAPIImplementation getAndTrackDeeplink: iterableLink callbackBlock: aBlock];
97
+ [IterableAPIInternal getAndTrackDeeplink: iterableLink callbackBlock: aBlock];
98
98
99
99
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
100
100
}
@@ -106,7 +106,7 @@ - (void)testUniversalDeeplinkNoRewrite {
106
106
XCTAssertEqualObjects (iterableNoRewriteURL, redirectUrl);
107
107
[expectation fulfill ];
108
108
};
109
- [IterableAPIImplementation getAndTrackDeeplink: normalLink callbackBlock: uBlock];
109
+ [IterableAPIInternal getAndTrackDeeplink: normalLink callbackBlock: uBlock];
110
110
111
111
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
112
112
}
@@ -123,9 +123,9 @@ - (void)testHandleUniversalLinkRewrite {
123
123
124
124
IterableConfig *config = [[IterableConfig alloc ] init ];
125
125
config.urlDelegate = urlDelegateMock;
126
- [IterableAPIImplementation initializeWithApiKey: @" " config: config];
126
+ [IterableAPIInternal initializeWithApiKey: @" " config: config];
127
127
NSURL *iterableLink = [NSURL URLWithString: iterableRewriteURL];
128
- [IterableAPIImplementation handleUniversalLink: iterableLink];
128
+ [[IterableAPIInternal sharedInstance ] handleUniversalLink: iterableLink];
129
129
130
130
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
131
131
}
@@ -138,12 +138,12 @@ - (void)testDeeplinkAttributionInfo {
138
138
XCTestExpectation *expectation = [self expectationWithDescription: @" High Expectations" ];
139
139
NSURL *normalLink = [NSURL URLWithString: iterableRewriteURL];
140
140
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);
144
144
[expectation fulfill ];
145
145
};
146
- [IterableAPIImplementation getAndTrackDeeplink: normalLink callbackBlock: uBlock];
146
+ [IterableAPIInternal getAndTrackDeeplink: normalLink callbackBlock: uBlock];
147
147
148
148
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
149
149
}
@@ -156,7 +156,7 @@ - (void)testNoURLRedirect {
156
156
XCTAssertNotEqual (exampleUrl, redirectUrl);
157
157
XCTAssertEqualObjects (redirectRequest, redirectUrl);
158
158
};
159
- [IterableAPIImplementation getAndTrackDeeplink: redirectLink callbackBlock: redirectBlock];
159
+ [IterableAPIInternal getAndTrackDeeplink: redirectLink callbackBlock: redirectBlock];
160
160
161
161
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
162
162
}
@@ -169,7 +169,7 @@ - (void)testUniversalDeeplinkHttp {
169
169
XCTAssertEqualObjects (googleHttps, redirectUrl);
170
170
XCTAssertNotEqual (googleHttp, redirectUrl);
171
171
};
172
- [IterableAPIImplementation getAndTrackDeeplink: googleHttpLink callbackBlock: googleHttpBlock];
172
+ [IterableAPIInternal getAndTrackDeeplink: googleHttpLink callbackBlock: googleHttpBlock];
173
173
174
174
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
175
175
}
@@ -183,13 +183,13 @@ - (void)testUniversalDeeplinkHttps {
183
183
[expectation fulfill ];
184
184
XCTAssertEqualObjects (googleHttps, redirectUrl);
185
185
};
186
- [IterableAPIImplementation getAndTrackDeeplink: googleHttpsLink callbackBlock: googleHttpsBlock];
186
+ [IterableAPIInternal getAndTrackDeeplink: googleHttpsLink callbackBlock: googleHttpsBlock];
187
187
188
188
[self waitForExpectationsWithTimeout: IterableNetworkResponseExpectationTimeout handler: nil ];
189
189
}
190
190
191
191
- (void )testURLQueryParamRewrite {
192
- [IterableAPIImplementation initializeWithApiKey: @" " ];
192
+ [IterableAPIInternal initializeWithApiKey: @" " ];
193
193
194
194
NSCharacterSet * set = [NSCharacterSet URLQueryAllowedCharacterSet ];
195
195
@@ -208,19 +208,19 @@ - (void)testURLQueryParamRewrite {
208
208
}
209
209
210
210
// Test full set of possible URLQueryAllowedCharacterSet characters
211
- NSString * encodedSet = [[IterableAPIImplementation sharedInstance ] encodeURLParam: strSet];
211
+ NSString * encodedSet = [[IterableAPIInternal sharedInstance ] encodeURLParam: strSet];
212
212
XCTAssertNotEqual (encodedSet, strSet);
213
213
XCTAssert ([encodedSet isEqualToString: @" !$&'()*%2B,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~" ]);
214
214
215
- NSString * encoded = [[
IterableAPIImplementation sharedInstance ]
encodeURLParam: @" [email protected] " ];
215
+ NSString * encoded = [[
IterableAPIInternal sharedInstance ]
encodeURLParam: @" [email protected] " ];
216
216
XCTAssertNotEqual (encoded,
@" [email protected] " );
217
217
XCTAssert ([encoded
isEqualToString: @" you%[email protected] " ]);
218
218
219
- NSString * emptySet = [[IterableAPIImplementation sharedInstance ] encodeURLParam: @" " ];
219
+ NSString * emptySet = [[IterableAPIInternal sharedInstance ] encodeURLParam: @" " ];
220
220
XCTAssertEqual (emptySet, @" " );
221
221
XCTAssert ([emptySet isEqualToString: @" " ]);
222
222
223
- NSString * nilSet = [[IterableAPIImplementation sharedInstance ] encodeURLParam: nil ];
223
+ NSString * nilSet = [[IterableAPIInternal sharedInstance ] encodeURLParam: nil ];
224
224
XCTAssertEqualObjects (nilSet, nil );
225
225
}
226
226
@@ -242,27 +242,27 @@ - (void)testRegisterToken {
242
242
243
243
IterableConfig *config = [[IterableConfig alloc ] init ];
244
244
config.pushIntegrationName = @" pushIntegration" ;
245
- [IterableAPIImplementation initializeWithApiKey: @" apiKey" config: config];
246
- [[
IterableAPIImplementation sharedInstance ]
setEmail: @" [email protected] " ];
247
- [[IterableAPIImplementation sharedInstance ] registerToken: [@" token" dataUsingEncoding: kCFStringEncodingUTF8 ]];
245
+ [IterableAPIInternal initializeWithApiKey: @" apiKey" config: config];
246
+ [[
IterableAPIInternal sharedInstance ]
setEmail: @" [email protected] " ];
247
+ [[IterableAPIInternal sharedInstance ] registerToken: [@" token" dataUsingEncoding: kCFStringEncodingUTF8 ]];
248
248
249
249
[self waitForExpectations: @[expectation] timeout: 5.0 ];
250
250
[OHHTTPStubs removeAllStubs ];
251
251
}
252
252
253
253
- (void )testEmailUserIdPersistence {
254
- [IterableAPIImplementation initializeWithApiKey: @" apiKey" ];
255
- [[
IterableAPIImplementation sharedInstance ]
setEmail: @" [email protected] " ];
254
+ [IterableAPIInternal initializeWithApiKey: @" apiKey" ];
255
+ [[
IterableAPIInternal sharedInstance ]
setEmail: @" [email protected] " ];
256
256
257
- [IterableAPIImplementation initializeWithApiKey: @" apiKey" ];
258
- XCTAssertEqualObjects ([
IterableAPIImplementation sharedInstance ].
email ,
@" [email protected] " );
259
- XCTAssertNil ([IterableAPIImplementation sharedInstance ].userId );
257
+ [IterableAPIInternal initializeWithApiKey: @" apiKey" ];
258
+ XCTAssertEqualObjects ([
IterableAPIInternal sharedInstance ].
email ,
@" [email protected] " );
259
+ XCTAssertNil ([IterableAPIInternal sharedInstance ].userId );
260
260
261
- [[IterableAPIImplementation sharedInstance ] setUserId: @" testUserId" ];
261
+ [[IterableAPIInternal sharedInstance ] setUserId: @" testUserId" ];
262
262
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 );
266
266
}
267
267
268
268
0 commit comments