Skip to content

Commit a8dff3d

Browse files
committed
Removed BranchDelegate tests
1 parent da6e7af commit a8dff3d

File tree

1 file changed

+163
-163
lines changed

1 file changed

+163
-163
lines changed

Branch-TestBed/Branch-SDK-Tests/BranchDelegate.Test.m

Lines changed: 163 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -27,169 +27,169 @@ @implementation BranchDelegateTest
2727

2828
// Test that Branch notifications work.
2929
// Test that they 1) work and 2) are sent in the right order.
30-
- (void) testNotificationsSuccess {
31-
32-
self.expectFailure = NO;
33-
self.notificationOrder = 0;
34-
35-
[[NSNotificationCenter defaultCenter]
36-
addObserver:self
37-
selector:@selector(branchWillStartSessionNotification:)
38-
name:BranchWillStartSessionNotification
39-
object:nil];
40-
41-
[[NSNotificationCenter defaultCenter]
42-
addObserver:self
43-
selector:@selector(branchDidStartSessionNotification:)
44-
name:BranchDidStartSessionNotification
45-
object:nil];
46-
47-
id serverInterfaceMock = OCMClassMock([BNCServerInterface class]);
48-
49-
BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper sharedInstance];
50-
Branch.branchKey = @"key_live_foo";
51-
52-
Branch *branch =
53-
[[Branch alloc]
54-
initWithInterface:serverInterfaceMock
55-
queue:[[BNCServerRequestQueue alloc] init]
56-
cache:[[BNCLinkCache alloc] init]
57-
preferenceHelper:preferenceHelper
58-
key:@"key_live_foo"];
59-
branch.delegate = self;
60-
61-
BNCServerResponse *openInstallResponse = [[BNCServerResponse alloc] init];
62-
openInstallResponse.data = @{
63-
@"data": @"{\"$og_title\":\"Content Title\",\"$randomized_bundle_token\":\"423237095633725879\",\"~feature\":\"Sharing Feature\",\"$desktop_url\":\"http://branch.io\",\"$canonical_identifier\":\"item/12345\",\"~id\":423243086454504450,\"~campaign\":\"some campaign\",\"+is_first_session\":false,\"~channel\":\"Distribution Channel\",\"$ios_url\":\"https://dev.branch.io/getting-started/sdk-integration-guide/guide/ios/\",\"$exp_date\":0,\"$currency\":\"$\",\"$publicly_indexable\":1,\"$content_type\":\"some type\",\"~creation_source\":3,\"$amount\":1000,\"$og_description\":\"My Content Description\",\"+click_timestamp\":1506983962,\"$og_image_url\":\"https://pbs.twimg.com/profile_images/658759610220703744/IO1HUADP.png\",\"+match_guaranteed\":true,\"+clicked_branch_link\":true,\"deeplink_text\":\"This text was embedded as data in a Branch link with the following characteristics:\\n\\ncanonicalUrl: https://dev.branch.io/getting-started/deep-link-routing/guide/ios/\\n title: Content Title\\n contentDescription: My Content Description\\n imageUrl: https://pbs.twimg.com/profile_images/658759610220703744/IO1HUADP.png\\n\",\"$one_time_use\":false,\"$canonical_url\":\"https://dev.branch.io/getting-started/deep-link-routing/guide/ios/\",\"~referring_link\":\"https://bnctestbed.app.link/izPBY2xCqF\"}",
64-
@"randomized_device_token": @"439892172783867901",
65-
@"randomized_bundle_token": @"439892172804841307",
66-
@"link": @"https://bnctestbed.app.link?%24randomized_bundle_token=439892172804841307",
67-
@"session_id": @"443529761084512316",
68-
};
69-
70-
__block BNCServerCallback openOrInstallCallback;
71-
id openOrInstallCallbackCheckBlock = [OCMArg checkWithBlock:^BOOL(BNCServerCallback callback) {
72-
openOrInstallCallback = callback;
73-
return YES;
74-
}];
75-
76-
id openOrInstallInvocation = ^(NSInvocation *invocation) {
77-
openOrInstallCallback(openInstallResponse, nil);
78-
};
79-
80-
id openOrInstallUrlCheckBlock = [OCMArg checkWithBlock:^BOOL(NSString *url) {
81-
return [url rangeOfString:@"open"].location != NSNotFound ||
82-
[url rangeOfString:@"install"].location != NSNotFound;
83-
}];
84-
[[[serverInterfaceMock expect]
85-
andDo:openOrInstallInvocation]
86-
postRequest:[OCMArg any]
87-
url:openOrInstallUrlCheckBlock
88-
key:[OCMArg any]
89-
callback:openOrInstallCallbackCheckBlock];
90-
91-
preferenceHelper.universalLinkUrl = nil;
92-
preferenceHelper.externalIntentURI = nil;
93-
preferenceHelper.referringURL = nil;
94-
95-
[branch clearNetworkQueue];
96-
XCTestExpectation *openExpectation = [self expectationWithDescription:@"Test open"];
97-
[branch initSessionWithLaunchOptions:@{}
98-
andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {
99-
// Callback block. Order: 2.
100-
XCTAssertNil(error);
101-
XCTAssertEqualObjects(preferenceHelper.sessionID, @"443529761084512316");
102-
XCTAssertTrue(self.notificationOrder == 2);
103-
self.notificationOrder++;
104-
self.deepLinkParams = params;
105-
[openExpectation fulfill];
106-
}
107-
];
108-
109-
[self waitForExpectationsWithTimeout:5.0 handler:NULL];
110-
XCTAssertTrue(self.notificationOrder == 5);
111-
[[NSNotificationCenter defaultCenter] removeObserver:self];
112-
branch.delegate = nil;
113-
}
114-
115-
// Test that Branch notifications work with a failure.
116-
// Test that they 1) work and 2) are sent in the right order.
117-
- (void) testNotificationsFailure {
118-
119-
self.expectFailure = YES;
120-
self.notificationOrder = 0;
121-
122-
[[NSNotificationCenter defaultCenter]
123-
addObserver:self
124-
selector:@selector(branchWillStartSessionNotification:)
125-
name:BranchWillStartSessionNotification
126-
object:nil];
127-
128-
[[NSNotificationCenter defaultCenter]
129-
addObserver:self
130-
selector:@selector(branchDidStartSessionNotification:)
131-
name:BranchDidStartSessionNotification
132-
object:nil];
133-
134-
id serverInterfaceMock = OCMClassMock([BNCServerInterface class]);
135-
136-
BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper sharedInstance];
137-
Branch.branchKey = @"key_live_foo";
138-
139-
Branch *branch =
140-
[[Branch alloc]
141-
initWithInterface:serverInterfaceMock
142-
queue:[[BNCServerRequestQueue alloc] init]
143-
cache:[[BNCLinkCache alloc] init]
144-
preferenceHelper:preferenceHelper
145-
key:@"key_live_foo"];
146-
branch.delegate = self;
147-
148-
BNCServerResponse *openInstallResponse = [[BNCServerResponse alloc] init];
149-
openInstallResponse.data = @{ };
150-
151-
__block BNCServerCallback openOrInstallCallback;
152-
id openOrInstallCallbackCheckBlock = [OCMArg checkWithBlock:^BOOL(BNCServerCallback callback) {
153-
openOrInstallCallback = callback;
154-
return YES;
155-
}];
156-
157-
id openOrInstallInvocation = ^(NSInvocation *invocation) {
158-
NSError *error = [NSError branchErrorWithCode:BNCNetworkServiceInterfaceError];
159-
openOrInstallCallback(openInstallResponse, error);
160-
};
161-
162-
id openOrInstallUrlCheckBlock = [OCMArg checkWithBlock:^BOOL(NSString *url) {
163-
return [url rangeOfString:@"open"].location != NSNotFound ||
164-
[url rangeOfString:@"install"].location != NSNotFound;
165-
}];
166-
167-
[[[serverInterfaceMock expect]
168-
andDo:openOrInstallInvocation]
169-
postRequest:[OCMArg any]
170-
url:openOrInstallUrlCheckBlock
171-
key:[OCMArg any]
172-
callback:openOrInstallCallbackCheckBlock];
173-
174-
[branch clearNetworkQueue];
175-
XCTestExpectation *openExpectation = [self expectationWithDescription:@"Test open"];
176-
[branch initSessionWithLaunchOptions:@{}
177-
andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {
178-
// Callback block. Order: 2.
179-
XCTAssertEqualObjects(params, @{});
180-
XCTAssertNotNil(error);
181-
XCTAssertTrue(self.notificationOrder == 2);
182-
self.notificationOrder++;
183-
self.deepLinkParams = params;
184-
[openExpectation fulfill];
185-
}
186-
];
187-
188-
[self waitForExpectationsWithTimeout:5.0 handler:NULL];
189-
XCTAssertTrue(self.notificationOrder == 5);
190-
[[NSNotificationCenter defaultCenter] removeObserver:self];
191-
branch.delegate = nil;
192-
}
30+
//- (void) testNotificationsSuccess {
31+
//
32+
// self.expectFailure = NO;
33+
// self.notificationOrder = 0;
34+
//
35+
// [[NSNotificationCenter defaultCenter]
36+
// addObserver:self
37+
// selector:@selector(branchWillStartSessionNotification:)
38+
// name:BranchWillStartSessionNotification
39+
// object:nil];
40+
//
41+
// [[NSNotificationCenter defaultCenter]
42+
// addObserver:self
43+
// selector:@selector(branchDidStartSessionNotification:)
44+
// name:BranchDidStartSessionNotification
45+
// object:nil];
46+
//
47+
// id serverInterfaceMock = OCMClassMock([BNCServerInterface class]);
48+
//
49+
// BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper sharedInstance];
50+
// Branch.branchKey = @"key_live_foo";
51+
//
52+
// Branch *branch =
53+
// [[Branch alloc]
54+
// initWithInterface:serverInterfaceMock
55+
// queue:[[BNCServerRequestQueue alloc] init]
56+
// cache:[[BNCLinkCache alloc] init]
57+
// preferenceHelper:preferenceHelper
58+
// key:@"key_live_foo"];
59+
// branch.delegate = self;
60+
//
61+
// BNCServerResponse *openInstallResponse = [[BNCServerResponse alloc] init];
62+
// openInstallResponse.data = @{
63+
// @"data": @"{\"$og_title\":\"Content Title\",\"$randomized_bundle_token\":\"423237095633725879\",\"~feature\":\"Sharing Feature\",\"$desktop_url\":\"http://branch.io\",\"$canonical_identifier\":\"item/12345\",\"~id\":423243086454504450,\"~campaign\":\"some campaign\",\"+is_first_session\":false,\"~channel\":\"Distribution Channel\",\"$ios_url\":\"https://dev.branch.io/getting-started/sdk-integration-guide/guide/ios/\",\"$exp_date\":0,\"$currency\":\"$\",\"$publicly_indexable\":1,\"$content_type\":\"some type\",\"~creation_source\":3,\"$amount\":1000,\"$og_description\":\"My Content Description\",\"+click_timestamp\":1506983962,\"$og_image_url\":\"https://pbs.twimg.com/profile_images/658759610220703744/IO1HUADP.png\",\"+match_guaranteed\":true,\"+clicked_branch_link\":true,\"deeplink_text\":\"This text was embedded as data in a Branch link with the following characteristics:\\n\\ncanonicalUrl: https://dev.branch.io/getting-started/deep-link-routing/guide/ios/\\n title: Content Title\\n contentDescription: My Content Description\\n imageUrl: https://pbs.twimg.com/profile_images/658759610220703744/IO1HUADP.png\\n\",\"$one_time_use\":false,\"$canonical_url\":\"https://dev.branch.io/getting-started/deep-link-routing/guide/ios/\",\"~referring_link\":\"https://bnctestbed.app.link/izPBY2xCqF\"}",
64+
// @"randomized_device_token": @"439892172783867901",
65+
// @"randomized_bundle_token": @"439892172804841307",
66+
// @"link": @"https://bnctestbed.app.link?%24randomized_bundle_token=439892172804841307",
67+
// @"session_id": @"443529761084512316",
68+
// };
69+
//
70+
// __block BNCServerCallback openOrInstallCallback;
71+
// id openOrInstallCallbackCheckBlock = [OCMArg checkWithBlock:^BOOL(BNCServerCallback callback) {
72+
// openOrInstallCallback = callback;
73+
// return YES;
74+
// }];
75+
//
76+
// id openOrInstallInvocation = ^(NSInvocation *invocation) {
77+
// openOrInstallCallback(openInstallResponse, nil);
78+
// };
79+
//
80+
// id openOrInstallUrlCheckBlock = [OCMArg checkWithBlock:^BOOL(NSString *url) {
81+
// return [url rangeOfString:@"open"].location != NSNotFound ||
82+
// [url rangeOfString:@"install"].location != NSNotFound;
83+
// }];
84+
// [[[serverInterfaceMock expect]
85+
// andDo:openOrInstallInvocation]
86+
// postRequest:[OCMArg any]
87+
// url:openOrInstallUrlCheckBlock
88+
// key:[OCMArg any]
89+
// callback:openOrInstallCallbackCheckBlock];
90+
//
91+
// preferenceHelper.universalLinkUrl = nil;
92+
// preferenceHelper.externalIntentURI = nil;
93+
// preferenceHelper.referringURL = nil;
94+
//
95+
// [branch clearNetworkQueue];
96+
// XCTestExpectation *openExpectation = [self expectationWithDescription:@"Test open"];
97+
// [branch initSessionWithLaunchOptions:@{}
98+
// andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {
99+
// // Callback block. Order: 2.
100+
// XCTAssertNil(error);
101+
// XCTAssertEqualObjects(preferenceHelper.sessionID, @"443529761084512316");
102+
// XCTAssertTrue(self.notificationOrder == 2);
103+
// self.notificationOrder++;
104+
// self.deepLinkParams = params;
105+
// [openExpectation fulfill];
106+
// }
107+
// ];
108+
//
109+
// [self waitForExpectationsWithTimeout:5.0 handler:NULL];
110+
// XCTAssertTrue(self.notificationOrder == 5);
111+
// [[NSNotificationCenter defaultCenter] removeObserver:self];
112+
// branch.delegate = nil;
113+
//}
114+
//
115+
//// Test that Branch notifications work with a failure.
116+
//// Test that they 1) work and 2) are sent in the right order.
117+
//- (void) testNotificationsFailure {
118+
//
119+
// self.expectFailure = YES;
120+
// self.notificationOrder = 0;
121+
//
122+
// [[NSNotificationCenter defaultCenter]
123+
// addObserver:self
124+
// selector:@selector(branchWillStartSessionNotification:)
125+
// name:BranchWillStartSessionNotification
126+
// object:nil];
127+
//
128+
// [[NSNotificationCenter defaultCenter]
129+
// addObserver:self
130+
// selector:@selector(branchDidStartSessionNotification:)
131+
// name:BranchDidStartSessionNotification
132+
// object:nil];
133+
//
134+
// id serverInterfaceMock = OCMClassMock([BNCServerInterface class]);
135+
//
136+
// BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper sharedInstance];
137+
// Branch.branchKey = @"key_live_foo";
138+
//
139+
// Branch *branch =
140+
// [[Branch alloc]
141+
// initWithInterface:serverInterfaceMock
142+
// queue:[[BNCServerRequestQueue alloc] init]
143+
// cache:[[BNCLinkCache alloc] init]
144+
// preferenceHelper:preferenceHelper
145+
// key:@"key_live_foo"];
146+
// branch.delegate = self;
147+
//
148+
// BNCServerResponse *openInstallResponse = [[BNCServerResponse alloc] init];
149+
// openInstallResponse.data = @{ };
150+
//
151+
// __block BNCServerCallback openOrInstallCallback;
152+
// id openOrInstallCallbackCheckBlock = [OCMArg checkWithBlock:^BOOL(BNCServerCallback callback) {
153+
// openOrInstallCallback = callback;
154+
// return YES;
155+
// }];
156+
//
157+
// id openOrInstallInvocation = ^(NSInvocation *invocation) {
158+
// NSError *error = [NSError branchErrorWithCode:BNCNetworkServiceInterfaceError];
159+
// openOrInstallCallback(openInstallResponse, error);
160+
// };
161+
//
162+
// id openOrInstallUrlCheckBlock = [OCMArg checkWithBlock:^BOOL(NSString *url) {
163+
// return [url rangeOfString:@"open"].location != NSNotFound ||
164+
// [url rangeOfString:@"install"].location != NSNotFound;
165+
// }];
166+
//
167+
// [[[serverInterfaceMock expect]
168+
// andDo:openOrInstallInvocation]
169+
// postRequest:[OCMArg any]
170+
// url:openOrInstallUrlCheckBlock
171+
// key:[OCMArg any]
172+
// callback:openOrInstallCallbackCheckBlock];
173+
//
174+
// [branch clearNetworkQueue];
175+
// XCTestExpectation *openExpectation = [self expectationWithDescription:@"Test open"];
176+
// [branch initSessionWithLaunchOptions:@{}
177+
// andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {
178+
// // Callback block. Order: 2.
179+
// XCTAssertEqualObjects(params, @{});
180+
// XCTAssertNotNil(error);
181+
// XCTAssertTrue(self.notificationOrder == 2);
182+
// self.notificationOrder++;
183+
// self.deepLinkParams = params;
184+
// [openExpectation fulfill];
185+
// }
186+
// ];
187+
//
188+
// [self waitForExpectationsWithTimeout:5.0 handler:NULL];
189+
// XCTAssertTrue(self.notificationOrder == 5);
190+
// [[NSNotificationCenter defaultCenter] removeObserver:self];
191+
// branch.delegate = nil;
192+
//}
193193

194194
#pragma mark - Delegate & Notification Methods
195195

0 commit comments

Comments
 (0)