Skip to content

Commit

Permalink
Test for EEA is failing on repeat run.
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-branch committed Feb 15, 2024
1 parent 9463e61 commit 1c4df07
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Branch-TestBed/Branch-SDK-Tests/BranchClassTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
#import "BNCAppGroupsData.h"
#import "BNCPartnerParameters.h"

@interface BNCPreferenceHelper(Test)
// Expose internal private method to clear EEA data
- (void)writeObjectToDefaults:(NSString *)key value:(NSObject *)value;
@end

@interface BranchClassTests : XCTestCase
@property (nonatomic, strong) Branch *branch;
@end
Expand Down Expand Up @@ -221,14 +226,19 @@ - (void)testGetLongURLWithParamsAndChannelAndTagsAndFeatureAndStageAndAlias {
}

- (void)testSetDMAParamsForEEA {

XCTAssertFalse([[BNCPreferenceHelper sharedInstance] eeaRegionInitialized]);

[Branch setDMAParamsForEEA:FALSE AdPersonalizationConsent:TRUE AdUserDataUsageConsent:TRUE];
XCTAssertTrue([[BNCPreferenceHelper sharedInstance] eeaRegionInitialized]);
XCTAssertFalse([BNCPreferenceHelper sharedInstance].eeaRegion);
XCTAssertTrue([BNCPreferenceHelper sharedInstance].adPersonalizationConsent);
XCTAssertTrue([BNCPreferenceHelper sharedInstance].adUserDataUsageConsent);

// Manually clear values after testing
// By design, this API is meant to be set once and always set. However, in a test scenario it needs to be cleared.
[[BNCPreferenceHelper sharedInstance] writeObjectToDefaults:@"bnc_dma_eea" value:nil];
[[BNCPreferenceHelper sharedInstance] writeObjectToDefaults:@"bnc_dma_ad_personalization" value:nil];
[[BNCPreferenceHelper sharedInstance] writeObjectToDefaults:@"bnc_dma_ad_user_data" value:nil];
}

@end

0 comments on commit 1c4df07

Please sign in to comment.