@@ -14,6 +14,7 @@ class ExtensionsTests: XCTestCase {
14
14
impression. label = " label "
15
15
impression. treatment = " on "
16
16
impression. time = 16161616
17
+ impression. properties = " { \" myProp \" : true} "
17
18
18
19
let impressionMap = impression. toMap ( )
19
20
XCTAssert ( impressionMap. count == 9 )
@@ -26,7 +27,7 @@ class ExtensionsTests: XCTestCase {
26
27
" treatment " : " on " ,
27
28
" split " : " my-split " ,
28
29
" time " : 16161616 ,
29
- " properties " : " {} " ] ) )
30
+ " properties " : " { \" myProp \" : true }" ] ) )
30
31
}
31
32
32
33
func testSplitViewMapping( ) throws {
@@ -39,14 +40,20 @@ class ExtensionsTests: XCTestCase {
39
40
splitView. configs = [ " key " : " value " ]
40
41
splitView. defaultTreatment = " off "
41
42
splitView. sets = [ " set1 " , " set2 " ]
43
+
44
+ let prerequisiteJSON = """
45
+ {
46
+ " n " : " pre1 " ,
47
+ " t " : [ " on " , " off " ]
48
+ }
49
+ """ . data ( using: . utf8) !
50
+
51
+ let prerequisite = try JSONDecoder ( ) . decode ( Prerequisite . self, from: prerequisiteJSON)
52
+ splitView. prerequisites = [ prerequisite]
42
53
splitView. impressionsDisabled = true
43
54
44
55
let splitViewMap = SplitView . asMap ( splitView: splitView)
45
-
46
- // Debug: Print actual values
47
- print ( " DEBUG - SplitView map count: \( splitViewMap. count) " )
48
- print ( " DEBUG - SplitView map: \( splitViewMap) " )
49
-
56
+
50
57
XCTAssert ( splitViewMap. count == 10 )
51
58
XCTAssert ( NSDictionary ( dictionary: splitViewMap) . isEqual ( to: [
52
59
" name " : " my-split " ,
@@ -58,24 +65,6 @@ class ExtensionsTests: XCTestCase {
58
65
" defaultTreatment " : " off " ,
59
66
" sets " : [ " set1 " , " set2 " ] ,
60
67
" impressionsDisabled " : true ,
61
- " prerequisites " : [ ] ] ) )
62
- }
63
-
64
- func testImpressionMappingDebug( ) throws {
65
- var impression = Impression ( )
66
- impression. keyName = " matching-key "
67
- impression. feature = " my-split "
68
- impression. changeNumber = 121212
69
- impression. bucketingKey = " bucketing-key "
70
- impression. attributes = [ " age " : 25 , " name " : " John " ]
71
- impression. label = " label "
72
- impression. treatment = " on "
73
- impression. time = 16161616
74
-
75
- let impressionMap = impression. toMap ( )
76
-
77
- // Debug: Print actual values
78
- print ( " DEBUG - Impression map count: \( impressionMap. count) " )
79
- print ( " DEBUG - Impression map: \( impressionMap) " )
68
+ " prerequisites " : [ prerequisite] ] ) )
80
69
}
81
70
}
0 commit comments