@@ -564,21 +564,21 @@ extension DecisionServiceTests_Experiments {
564564 XCTAssertFalse ( result)
565565 }
566566
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+ }
582582
583583 func testDoesMeetAudienceConditionsWithExactMatchAndInvalidAttributeValue( ) {
584584 MockLogger . expectedLog = OptimizelyError . evaluateAttributeInvalidType ( " { \" match \" : \" exact \" , \" value \" : \" us \" , \" name \" : \" country \" , \" type \" : \" custom_attribute \" } " , [ " invalid " ] , " country " ) . localizedDescription
@@ -612,21 +612,20 @@ extension DecisionServiceTests_Experiments {
612612 XCTAssertFalse ( result)
613613 }
614614
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+ }
630629
631630 func testDoesMeetAudienceConditionsWithGreaterMatchAndInvalidAttributeValue( ) {
632631 MockLogger . expectedLog = OptimizelyError . evaluateAttributeInvalidType ( " { \" match \" : \" gt \" , \" value \" :17, \" name \" : \" age \" , \" type \" : \" custom_attribute \" } " , [ " invalid " ] , " age " ) . localizedDescription
@@ -644,21 +643,20 @@ extension DecisionServiceTests_Experiments {
644643 XCTAssertFalse ( result)
645644 }
646645
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+ }
662660
663661 func testDoesMeetAudienceConditionsWithLessMatchAndInvalidAttributeValue( ) {
664662 MockLogger . expectedLog = OptimizelyError . evaluateAttributeInvalidType ( " { \" match \" : \" lt \" , \" value \" :17, \" name \" : \" age \" , \" type \" : \" custom_attribute \" } " , [ " invalid " ] , " age " ) . localizedDescription
0 commit comments