Skip to content

Commit

Permalink
fix: Add few more test for false scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
polok committed Nov 10, 2023
1 parent de5e0b5 commit 22ba05f
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions Tests/FeaturevisorSDKTests/ConditionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ConditionsTests: XCTestCase {
XCTAssertTrue(conditionIsMatched(condition: condition, context: context))
}

func testStringInArray() {
func testStringInArrayShouldReturnTrue() {
//Given
let condition = PlainCondition(
attribute: "text",
Expand All @@ -119,7 +119,23 @@ class ConditionsTests: XCTestCase {
XCTAssertTrue(conditionIsMatched(condition: condition, context: context))
}

func testStringNotInArray() {
func testStringInArrayShouldReturnFalse() {
//Given
let condition = PlainCondition(
attribute: "text",
operator: .in,
value: .array(["test-1", "test-2"])
)
var context = Context()

//When
context["text"] = .string("test-3")

//Then
XCTAssertFalse(conditionIsMatched(condition: condition, context: context))
}

func testStringNotInArrayShouldReturnTrue() {
//Given
let condition = PlainCondition(
attribute: "text",
Expand All @@ -135,6 +151,22 @@ class ConditionsTests: XCTestCase {
XCTAssertTrue(conditionIsMatched(condition: condition, context: context))
}

func testStringNotInArrayShouldReturnFalse() {
//Given
let condition = PlainCondition(
attribute: "text",
operator: .notIn,
value: .array(["test-1", "test-2"])
)
var context = Context()

//When
context["text"] = .string("test-2")

//Then
XCTAssertFalse(conditionIsMatched(condition: condition, context: context))
}

func testDateBefore() {

//Given
Expand Down

0 comments on commit 22ba05f

Please sign in to comment.