File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -166,9 +166,9 @@ - (NSString *)getBucketingId:(NSString *)userId
166
166
// in place of the userID for the murmur hash key
167
167
168
168
if (attributes != nil ) {
169
- NSString *validBucketingId = [attributes[OptimizelyBucketId] getValidString ];
170
- if (validBucketingId != nil ) {
171
- bucketingId = validBucketingId ;
169
+ BOOL isValidStringType = [attributes[OptimizelyBucketId] isValidStringType ];
170
+ if (isValidStringType ) {
171
+ bucketingId = [attributes[OptimizelyBucketId] getStringOrEmpty ] ;
172
172
[self .config.logger logMessage: [NSString stringWithFormat: OPTLYLoggerMessagesDecisionServiceSettingTheBucketingID,
173
173
bucketingId]
174
174
withLevel: OptimizelyLogLevelDebug];
Original file line number Diff line number Diff line change @@ -466,6 +466,18 @@ - (void)testGetVariationWithInvalidBucketingId {
466
466
kExperimentWithAudienceVariationKey , variation.variationKey );
467
467
}
468
468
469
+ - (void )testGetVariationWithEmptyBucketingId {
470
+ OPTLYExperiment *experiment = [self .config getExperimentForKey: kExperimentNoAudienceKey ];
471
+ OPTLYVariation *variation = [self .decisionService getVariation: kUserId experiment: experiment attributes: nil ];
472
+
473
+ XCTAssertNotNil (variation, @" Get variation" );
474
+
475
+ NSDictionary *attributes = @{OptimizelyBucketId: @" " };
476
+ OPTLYVariation *variationWithEmptyBucketingId = [self .decisionService getVariation: kUserId experiment: experiment attributes: attributes];
477
+
478
+ XCTAssertNotEqual (variation.variationKey ,variationWithEmptyBucketingId.variationKey );
479
+ }
480
+
469
481
- (void )testGetVariationAcceptAllTypeAttributes {
470
482
471
483
OPTLYExperiment *experiment = [self .config getExperimentForKey: kExperimentNoAudienceKey ];
You can’t perform that action at this time.
0 commit comments