@@ -564,21 +564,21 @@ extension DecisionServiceTests_Experiments {
564
564
XCTAssertFalse ( result)
565
565
}
566
566
567
- // func testDoesMeetAudienceConditionsWithExactMatchAndInvalidValue() {
568
- // MockLogger.expectedLog = OptimizelyError.evaluateAttributeInvalidCondition("{\"match\":\"exact\",\"value\":{},\"name\":\"age\",\"type\":\"custom_attribute\"}").localizedDescription
569
- // self.config.project.typedAudiences = try! OTUtils.model(from: sampleTypedAudiencesData)
570
- //
571
- // experiment = try! OTUtils.model(from: sampleExperimentData)
572
- // experiment.audienceIds = [kAudienceIdExactInvalidValue]
573
- // self.config.project.experiments = [experiment]
574
- //
575
- // result = self.decisionService.doesMeetAudienceConditions(config: config,
576
- // experiment: experiment,
577
- // user: OTUtils.user(userId: kUserId, attributes: kAttributesAgeMatch)).result
578
- //
579
- // XCTAssert(MockLogger.logFound)
580
- // XCTAssertFalse(result)
581
- // }
567
+ func testDoesMeetAudienceConditionsWithExactMatchAndInvalidValue( ) {
568
+ MockLogger . expectedLog = OptimizelyError . evaluateAttributeInvalidCondition ( " { \" match \" : \" exact \" , \" value \" :{}, \" name \" : \" age \" , \" type \" : \" custom_attribute \" } " ) . localizedDescription
569
+ self . config. project. typedAudiences = try ! OTUtils . model ( from: sampleTypedAudiencesData)
570
+
571
+ experiment = try ! OTUtils . model ( from: sampleExperimentData)
572
+ experiment. audienceIds = [ kAudienceIdExactInvalidValue]
573
+ self . config. project. experiments = [ experiment]
574
+
575
+ result = self . decisionService. doesMeetAudienceConditions ( config: config,
576
+ experiment: experiment,
577
+ user: OTUtils . user ( userId: kUserId, attributes: kAttributesAgeMatch) ) . result
578
+
579
+ XCTAssert ( MockLogger . logFound)
580
+ XCTAssertFalse ( result)
581
+ }
582
582
583
583
func testDoesMeetAudienceConditionsWithExactMatchAndInvalidAttributeValue( ) {
584
584
MockLogger . expectedLog = OptimizelyError . evaluateAttributeInvalidType ( " { \" match \" : \" exact \" , \" value \" : \" us \" , \" name \" : \" country \" , \" type \" : \" custom_attribute \" } " , [ " invalid " ] , " country " ) . localizedDescription
@@ -612,21 +612,20 @@ extension DecisionServiceTests_Experiments {
612
612
XCTAssertFalse ( result)
613
613
}
614
614
615
- // func testDoesMeetAudienceConditionsWithGreaterMatchAndInvalidValue() {
616
- // MockLogger.expectedLog = OptimizelyError.evaluateAttributeInvalidCondition("{\"match\":\"gt\",\"value\":{},\"name\":\"age\",\"type\":\"custom_attribute\"}").localizedDescription
617
- // self.config.project.typedAudiences = try! OTUtils.model(from: sampleTypedAudiencesData)
618
- //
619
- // experiment = try! OTUtils.model(from: sampleExperimentData)
620
- // experiment.audienceIds = [kAudienceIdGtInvalidValue]
621
- // self.config.project.experiments = [experiment]
622
- //
623
- // result = self.decisionService.doesMeetAudienceConditions(config: config,
624
- // experiment: experiment,
625
- // user: OTUtils.user(userId: kUserId, attributes: kAttributesAgeMatch)).result
626
- //
627
- // XCTAssert(MockLogger.logFound)
628
- // XCTAssertFalse(result)
629
- // }
615
+ func testDoesMeetAudienceConditionsWithGreaterMatchAndInvalidValue( ) {
616
+ MockLogger . expectedLog = OptimizelyError . evaluateAttributeInvalidCondition ( " { \" match \" : \" gt \" , \" value \" :{}, \" name \" : \" age \" , \" type \" : \" custom_attribute \" } " ) . localizedDescription
617
+ self . config. project. typedAudiences = try ! OTUtils . model ( from: sampleTypedAudiencesData)
618
+
619
+ experiment = try ! OTUtils . model ( from: sampleExperimentData)
620
+ experiment. audienceIds = [ kAudienceIdGtInvalidValue]
621
+ self . config. project. experiments = [ experiment]
622
+
623
+ result = self . decisionService. doesMeetAudienceConditions ( config: config,
624
+ experiment: experiment,
625
+ user: OTUtils . user ( userId: kUserId, attributes: kAttributesAgeMatch) ) . result
626
+
627
+ XCTAssertFalse ( result)
628
+ }
630
629
631
630
func testDoesMeetAudienceConditionsWithGreaterMatchAndInvalidAttributeValue( ) {
632
631
MockLogger . expectedLog = OptimizelyError . evaluateAttributeInvalidType ( " { \" match \" : \" gt \" , \" value \" :17, \" name \" : \" age \" , \" type \" : \" custom_attribute \" } " , [ " invalid " ] , " age " ) . localizedDescription
@@ -644,21 +643,20 @@ extension DecisionServiceTests_Experiments {
644
643
XCTAssertFalse ( result)
645
644
}
646
645
647
- // func testDoesMeetAudienceConditionsWithLessMatchAndInvalidValue() {
648
- // MockLogger.expectedLog = OptimizelyError.evaluateAttributeInvalidCondition("{\"match\":\"lt\",\"value\":{},\"name\":\"age\",\"type\":\"custom_attribute\"}").localizedDescription
649
- // self.config.project.typedAudiences = try! OTUtils.model(from: sampleTypedAudiencesData)
650
- //
651
- // experiment = try! OTUtils.model(from: sampleExperimentData)
652
- // experiment.audienceIds = [kAudienceIdLtInvalidValue]
653
- // self.config.project.experiments = [experiment]
654
- //
655
- // result = self.decisionService.doesMeetAudienceConditions(config: config,
656
- // experiment: experiment,
657
- // user: OTUtils.user(userId: kUserId, attributes: kAttributesAgeMatch)).result
658
- //
659
- // XCTAssert(MockLogger.logFound)
660
- // XCTAssertFalse(result)
661
- // }
646
+ func testDoesMeetAudienceConditionsWithLessMatchAndInvalidValue( ) {
647
+ MockLogger . expectedLog = OptimizelyError . evaluateAttributeInvalidCondition ( " { \" match \" : \" lt \" , \" value \" :{}, \" name \" : \" age \" , \" type \" : \" custom_attribute \" } " ) . localizedDescription
648
+ self . config. project. typedAudiences = try ! OTUtils . model ( from: sampleTypedAudiencesData)
649
+
650
+ experiment = try ! OTUtils . model ( from: sampleExperimentData)
651
+ experiment. audienceIds = [ kAudienceIdLtInvalidValue]
652
+ self . config. project. experiments = [ experiment]
653
+
654
+ result = self . decisionService. doesMeetAudienceConditions ( config: config,
655
+ experiment: experiment,
656
+ user: OTUtils . user ( userId: kUserId, attributes: kAttributesAgeMatch) ) . result
657
+
658
+ XCTAssertFalse ( result)
659
+ }
662
660
663
661
func testDoesMeetAudienceConditionsWithLessMatchAndInvalidAttributeValue( ) {
664
662
MockLogger . expectedLog = OptimizelyError . evaluateAttributeInvalidType ( " { \" match \" : \" lt \" , \" value \" :17, \" name \" : \" age \" , \" type \" : \" custom_attribute \" } " , [ " invalid " ] , " age " ) . localizedDescription
0 commit comments