Skip to content

Commit ed1315c

Browse files
committed
reverting change to AttributeValueTests.
1 parent a7e7ece commit ed1315c

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Tests/OptimizelyTests-DataModel/AttributeValueTests.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,11 @@ extension AttributeValueTests {
346346
let attr = AttributeValue.others
347347
var tmpError: Error?
348348
do {
349-
_ = try attr.isExactMatch(with: invalidValue)
349+
_ = try attr.isExactMatch(with: invalidValue, condition: conditionString, name: attributeKey)
350350
} catch {
351351
tmpError = error
352352
}
353-
XCTAssertNotNil(tmpError)
353+
XCTAssertEqual("[Optimizely][Error] " + tmpError!.localizedDescription, OptimizelyError.evaluateAttributeInvalidCondition(conditionString).localizedDescription)
354354
}
355355

356356
func testIsExactMatchWithInfiniteValue() {
@@ -368,34 +368,34 @@ extension AttributeValueTests {
368368
let attr = AttributeValue.string("string")
369369
var tmpError: Error?
370370
do {
371-
_ = try attr.isExactMatch(with: invalidValue)
371+
_ = try attr.isExactMatch(with: invalidValue, condition: conditionString, name: attributeKey)
372372
} catch {
373373
tmpError = error
374374
}
375-
XCTAssertNotNil(tmpError)
375+
XCTAssertEqual("[Optimizely][Error] " + tmpError!.localizedDescription, OptimizelyError.evaluateAttributeInvalidType(conditionString, invalidValue, attributeKey).localizedDescription)
376376
}
377377

378378
func testIsExactMatchWithInfiniteAttributeValue() {
379379
let attr = AttributeValue.double(1)
380380
let value = Double.infinity
381381
var tmpError: Error?
382382
do {
383-
_ = try attr.isExactMatch(with: value)
383+
_ = try attr.isExactMatch(with: value, condition: conditionString, name: attributeKey)
384384
} catch {
385385
tmpError = error
386386
}
387-
XCTAssertNotNil(tmpError)
387+
XCTAssertEqual("[Optimizely][Error] " + tmpError!.localizedDescription, OptimizelyError.evaluateAttributeValueOutOfRange(conditionString, attributeKey).localizedDescription)
388388
}
389389

390390
func testIsGreaterWithInvalidValue() {
391391
let attr = AttributeValue.string("")
392392
var tmpError: Error?
393393
do {
394-
_ = try attr.isGreater(than: Double(1))
394+
_ = try attr.isGreater(than: Double(1), condition: conditionString, name: attributeKey)
395395
} catch {
396396
tmpError = error
397397
}
398-
XCTAssertNotNil(tmpError)
398+
XCTAssertEqual("[Optimizely][Error] " + tmpError!.localizedDescription, OptimizelyError.evaluateAttributeInvalidCondition(conditionString).localizedDescription)
399399
}
400400

401401
func testIsGreaterWithInfiniteValue() {
@@ -413,22 +413,22 @@ extension AttributeValueTests {
413413
let attr = AttributeValue.double(100.23)
414414
var tmpError: Error?
415415
do {
416-
_ = try attr.isGreater(than: invalidValue)
416+
_ = try attr.isGreater(than: invalidValue, condition: conditionString, name: attributeKey)
417417
} catch {
418418
tmpError = error
419419
}
420-
XCTAssertNotNil(tmpError)
420+
XCTAssertEqual("[Optimizely][Error] " + tmpError!.localizedDescription, OptimizelyError.evaluateAttributeInvalidType(conditionString, invalidValue, attributeKey).localizedDescription)
421421
}
422422

423423
func testIsLessWithInvalidValue() {
424424
let attr = AttributeValue.string("")
425425
var tmpError: Error?
426426
do {
427-
_ = try attr.isLess(than: Double(1))
427+
_ = try attr.isLess(than: Double(1), condition: conditionString, name: attributeKey)
428428
} catch {
429429
tmpError = error
430430
}
431-
XCTAssertNotNil(tmpError)
431+
XCTAssertEqual("[Optimizely][Error] " + tmpError!.localizedDescription, OptimizelyError.evaluateAttributeInvalidCondition(conditionString).localizedDescription)
432432
}
433433

434434
func testIsLessWithInfiniteValue() {
@@ -446,33 +446,33 @@ extension AttributeValueTests {
446446
let attr = AttributeValue.double(100.23)
447447
var tmpError: Error?
448448
do {
449-
_ = try attr.isLess(than: invalidValue)
449+
_ = try attr.isLess(than: invalidValue, condition: conditionString, name: attributeKey)
450450
} catch {
451451
tmpError = error
452452
}
453-
XCTAssertNotNil(tmpError)
453+
XCTAssertEqual("[Optimizely][Error] " + tmpError!.localizedDescription, OptimizelyError.evaluateAttributeInvalidType(conditionString, invalidValue, attributeKey).localizedDescription)
454454
}
455455

456456
func testIsSubstringWithInvalidValue() {
457457
let attr = AttributeValue.double(1)
458458
var tmpError: Error?
459459
do {
460-
_ = try attr.isSubstring(of: "valid")
460+
_ = try attr.isSubstring(of: "valid", condition: conditionString, name: attributeKey)
461461
} catch {
462462
tmpError = error
463463
}
464-
XCTAssertNotNil(tmpError)
464+
XCTAssertEqual("[Optimizely][Error] " + tmpError!.localizedDescription, OptimizelyError.evaluateAttributeInvalidCondition(conditionString).localizedDescription)
465465
}
466466

467467
func testIsSubstringWithInvalidAttributeValue() {
468468
let attr = AttributeValue.string("valid")
469469
var tmpError: Error?
470470
do {
471-
_ = try attr.isSubstring(of: invalidValue)
471+
_ = try attr.isSubstring(of: invalidValue, condition: conditionString, name: attributeKey)
472472
} catch {
473473
tmpError = error
474474
}
475-
XCTAssertNotNil(tmpError)
475+
XCTAssertEqual("[Optimizely][Error] " + tmpError!.localizedDescription, OptimizelyError.evaluateAttributeInvalidType(conditionString, invalidValue, attributeKey).localizedDescription)
476476
}
477477

478478
func testIsValidForExactMatcher() {

0 commit comments

Comments
 (0)