Skip to content

Commit c545971

Browse files
authored
DEVEX-826 Fix Unit Tests (#891)
* Fix blacklist unit test. * Removed Swift 3 reference.
1 parent 01027f7 commit c545971

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

Branch-SDK-Tests/BNCURLBlackList.Test.m

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ - (void) testStandardBlackList {
143143
callback:[OCMArg any]]
144144
).andDo(^(NSInvocation *invocation) {
145145
__unsafe_unretained NSDictionary *dictionary = nil;
146+
__unsafe_unretained NSString *url = nil;
146147
[invocation getArgument:&dictionary atIndex:2];
148+
[invocation getArgument:&url atIndex:3];
147149

148150
NSLog(@"d: %@", dictionary);
149151
NSString* link = dictionary[@"external_intent_uri"];
@@ -153,6 +155,10 @@ - (void) testStandardBlackList {
153155
if ([link isEqualToString:pattern1] || [link isEqualToString:pattern2]) {
154156
[expectation fulfill];
155157
}
158+
else
159+
if ([url bnc_containsString:@"install"]) {
160+
[expectation fulfill];
161+
}
156162
});
157163
[branch clearNetworkQueue];
158164
[branch handleDeepLinkWithNewSession:[NSURL URLWithString:@"https://myapp.app.link/bob/link?oauth=true"]];
@@ -183,13 +189,15 @@ - (void) testUserBlackList {
183189
[invocation getArgument:&dictionary atIndex:2];
184190
[invocation getArgument:&URL atIndex:3];
185191

186-
if ([URL bnc_containsString:@"open"] || [URL bnc_containsString:@"install"]) {
187-
NSString* link = dictionary[@"external_intent_uri"];
188-
NSString *pattern = @"\\/bob\\/";
189-
NSLog(@"\n URL: '%@'\n Link: '%@'\nPattern: '%@'\n.", URL, link, pattern);
190-
if ([link isEqualToString:pattern]) {
191-
[expectation fulfill];
192-
}
192+
NSString* link = dictionary[@"external_intent_uri"];
193+
NSString *pattern = @"\\/bob\\/";
194+
NSLog(@"\n URL: '%@'\n Link: '%@'\nPattern: '%@'\n.", URL, link, pattern);
195+
if ([link isEqualToString:pattern]) {
196+
[expectation fulfill];
197+
}
198+
else
199+
if ([URL bnc_containsString:@"install"]) {
200+
[expectation fulfill];
193201
}
194202
});
195203
[branch handleDeepLinkWithNewSession:[NSURL URLWithString:@"https://myapp.app.link/bob/link"]];

Branch-TestBed/Branch-TestBed.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,7 @@
13431343
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
13441344
ONLY_ACTIVE_ARCH = YES;
13451345
SDKROOT = iphoneos;
1346+
SWIFT_VERSION = 4.2;
13461347
};
13471348
name = Debug;
13481349
};
@@ -1395,6 +1396,7 @@
13951396
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
13961397
SDKROOT = iphoneos;
13971398
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
1399+
SWIFT_VERSION = 4.2;
13981400
VALIDATE_PRODUCT = YES;
13991401
};
14001402
name = Release;
@@ -1461,7 +1463,6 @@
14611463
PRODUCT_NAME = "$(TARGET_NAME)";
14621464
SWIFT_OBJC_BRIDGING_HEADER = "../Branch-SDK-Tests/Branch-SDK-Tests-Bridging-Header.h";
14631465
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1464-
SWIFT_VERSION = 3.0;
14651466
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Branch-TestBed.app/Branch-TestBed";
14661467
};
14671468
name = Debug;
@@ -1481,7 +1482,6 @@
14811482
PRODUCT_BUNDLE_IDENTIFIER = "io.branch.sdk.$(PRODUCT_NAME:rfc1034identifier)";
14821483
PRODUCT_NAME = "$(TARGET_NAME)";
14831484
SWIFT_OBJC_BRIDGING_HEADER = "../Branch-SDK-Tests/Branch-SDK-Tests-Bridging-Header.h";
1484-
SWIFT_VERSION = 3.0;
14851485
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Branch-TestBed.app/Branch-TestBed";
14861486
};
14871487
name = Release;

0 commit comments

Comments
 (0)