Skip to content

Commit

Permalink
wip: test case updated
Browse files Browse the repository at this point in the history
  • Loading branch information
muzahidul-opti committed Jan 29, 2025
1 parent 478ecb6 commit 99a0f65
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Sources/Data Model/Audience/AttributeValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ enum AttributeValue: Codable, Equatable, CustomStringConvertible {
}


// accept all other types (null, {}, []) for forward compatibility support
// accept all other types (null) for forward compatibility support
self = .others
}

Expand Down Expand Up @@ -321,6 +321,7 @@ extension AttributeValue {
case (.double): return true
case (.bool): return true
case (.array): return true
case (.dictionary): return true
default: return false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,12 @@ extension BatchEventBuilderTests_EventTags {
"Text": "value",
"nested": [
"foot": "value",
"mouch": "valuefalsdf"
]
"mouth": "mouth_value"
],
"stringArray": ["a", "b", "c"],
"intArray": [1, 2, 3],
"doubleArray": [1.0, 2.0, 3.0],
"boolAray": [false, true, false, true],
]
let eventKey = "event_single_targeted_exp"
let eventTags: [String: Any] = ["browser": "chrome",
Expand All @@ -350,6 +354,14 @@ extension BatchEventBuilderTests_EventTags {
XCTAssertEqual(de["revenue"] as! Int, 40, "value must be valid for revenue")
XCTAssertEqual(de["value"] as! Double, 32, "value must be valid for value")

XCTAssertEqual((tags["$opt_event_properties"] as! [String : Any])["category"] as! String, "shoes")
XCTAssertEqual((tags["$opt_event_properties"] as! [String : Any])["nested"] as! [String : String], ["foot": "value", "mouth": "mouth_value"])

XCTAssertEqual((tags["$opt_event_properties"] as! [String : Any])["stringArray"] as! [String], ["a", "b", "c"])
XCTAssertEqual((tags["$opt_event_properties"] as! [String : Any])["intArray"] as! [Int], [1, 2, 3])
XCTAssertEqual((tags["$opt_event_properties"] as! [String : Any])["doubleArray"] as! [Double], [1, 2, 3])
XCTAssertEqual((tags["$opt_event_properties"] as! [String : Any])["boolAray"] as! [Bool], [false, true, false, true])


}

Expand Down

0 comments on commit 99a0f65

Please sign in to comment.