Skip to content

Commit 478ecb6

Browse files
wip: test case updated
1 parent 3aba9ea commit 478ecb6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Tests/OptimizelyTests-Common/DecisionServiceTests_Experiments.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,17 @@ class DecisionServiceTests_Experiments: XCTestCase {
158158
],
159159
[
160160
"id": kAudienceIdExactInvalidValue,
161-
"conditions": [ "type": "custom_attribute", "name": "age", "match": "exact", "value": ["invalid"] ],
161+
"conditions": [ "type": "custom_attribute", "name": "age", "match": "exact", "value": ["invalid" : nil] ],
162162
"name": "age"
163163
],
164164
[
165165
"id": kAudienceIdGtInvalidValue,
166-
"conditions": [ "type": "custom_attribute", "name": "age", "match": "gt", "value": ["invalid"] ],
166+
"conditions": [ "type": "custom_attribute", "name": "age", "match": "gt", "value": ["invalid" : nil] ],
167167
"name": "age"
168168
],
169169
[
170170
"id": kAudienceIdLtInvalidValue,
171-
"conditions": [ "type": "custom_attribute", "name": "age", "match": "lt", "value": ["invalid"] ],
171+
"conditions": [ "type": "custom_attribute", "name": "age", "match": "lt", "value": ["invalid" : nil] ],
172172
"name": "age"
173173
],
174174
[
@@ -565,7 +565,7 @@ extension DecisionServiceTests_Experiments {
565565
}
566566

567567
func testDoesMeetAudienceConditionsWithExactMatchAndInvalidValue() {
568-
MockLogger.expectedLog = OptimizelyError.evaluateAttributeInvalidCondition("{\"match\":\"exact\",\"value\":{},\"name\":\"age\",\"type\":\"custom_attribute\"}").localizedDescription
568+
MockLogger.expectedLog = OptimizelyError.evaluateAttributeInvalidCondition("{\"match\":\"exact\",\"value\":{\"invalid\":{}},\"name\":\"age\",\"type\":\"custom_attribute\"}").localizedDescription
569569
self.config.project.typedAudiences = try! OTUtils.model(from: sampleTypedAudiencesData)
570570

571571
experiment = try! OTUtils.model(from: sampleExperimentData)
@@ -575,7 +575,7 @@ extension DecisionServiceTests_Experiments {
575575
result = self.decisionService.doesMeetAudienceConditions(config: config,
576576
experiment: experiment,
577577
user: OTUtils.user(userId: kUserId, attributes: kAttributesAgeMatch)).result
578-
578+
XCTAssert(MockLogger.logFound)
579579
XCTAssertFalse(result)
580580
}
581581

@@ -612,7 +612,7 @@ extension DecisionServiceTests_Experiments {
612612
}
613613

614614
func testDoesMeetAudienceConditionsWithGreaterMatchAndInvalidValue() {
615-
MockLogger.expectedLog = OptimizelyError.evaluateAttributeInvalidCondition("{\"match\":\"gt\",\"value\":{},\"name\":\"age\",\"type\":\"custom_attribute\"}").localizedDescription
615+
MockLogger.expectedLog = OptimizelyError.evaluateAttributeInvalidCondition("{\"match\":\"gt\",\"value\":{\"invalid\":{}},\"name\":\"age\",\"type\":\"custom_attribute\"}").localizedDescription
616616
self.config.project.typedAudiences = try! OTUtils.model(from: sampleTypedAudiencesData)
617617

618618
experiment = try! OTUtils.model(from: sampleExperimentData)
@@ -622,7 +622,7 @@ extension DecisionServiceTests_Experiments {
622622
result = self.decisionService.doesMeetAudienceConditions(config: config,
623623
experiment: experiment,
624624
user: OTUtils.user(userId: kUserId, attributes: kAttributesAgeMatch)).result
625-
625+
XCTAssert(MockLogger.logFound)
626626
XCTAssertFalse(result)
627627
}
628628

@@ -643,7 +643,7 @@ extension DecisionServiceTests_Experiments {
643643
}
644644

645645
func testDoesMeetAudienceConditionsWithLessMatchAndInvalidValue() {
646-
MockLogger.expectedLog = OptimizelyError.evaluateAttributeInvalidCondition("{\"match\":\"lt\",\"value\":{},\"name\":\"age\",\"type\":\"custom_attribute\"}").localizedDescription
646+
MockLogger.expectedLog = OptimizelyError.evaluateAttributeInvalidCondition("{\"match\":\"lt\",\"value\":{\"invalid\":{}},\"name\":\"age\",\"type\":\"custom_attribute\"}").localizedDescription
647647
self.config.project.typedAudiences = try! OTUtils.model(from: sampleTypedAudiencesData)
648648

649649
experiment = try! OTUtils.model(from: sampleExperimentData)
@@ -653,7 +653,7 @@ extension DecisionServiceTests_Experiments {
653653
result = self.decisionService.doesMeetAudienceConditions(config: config,
654654
experiment: experiment,
655655
user: OTUtils.user(userId: kUserId, attributes: kAttributesAgeMatch)).result
656-
656+
XCTAssert(MockLogger.logFound)
657657
XCTAssertFalse(result)
658658
}
659659

0 commit comments

Comments
 (0)