@@ -47,62 +47,98 @@ describe('Condition builder', () => {
47
47
} ) ;
48
48
49
49
it ( 'sets the property key' , ( ) => {
50
- const cn = new Condition ( ) . prop ( 'my_prop' ) . eq ( 'dancing monkeys' ) . build ( ) ;
50
+ const cn = new Condition ( )
51
+ . prop ( 'my_prop' )
52
+ . eq ( 'dancing monkeys' )
53
+ . build ( ) ;
51
54
expect ( cn ) . toBe ( '["my_prop"] == "dancing monkeys"' ) ;
52
55
} ) ;
53
56
54
57
it ( 'builds boolean condition' , ( ) => {
55
- const cn = new Condition ( ) . prop ( 'my_prop' ) . is ( true ) . build ( ) ;
58
+ const cn = new Condition ( )
59
+ . prop ( 'my_prop' )
60
+ . is ( true )
61
+ . build ( ) ;
56
62
expect ( cn ) . toBe ( '["my_prop"] is true' ) ;
57
63
} ) ;
58
64
59
65
it ( 'builds equality condition' , ( ) => {
60
- const cn = new Condition ( ) . prop ( 'my_prop' ) . eq ( 'dancing monkeys' ) . build ( ) ;
66
+ const cn = new Condition ( )
67
+ . prop ( 'my_prop' )
68
+ . eq ( 'dancing monkeys' )
69
+ . build ( ) ;
61
70
expect ( cn ) . toBe ( '["my_prop"] == "dancing monkeys"' ) ;
62
71
} ) ;
63
72
64
73
it ( 'builds inequality condition' , ( ) => {
65
- const cn = new Condition ( ) . prop ( 'my_prop' ) . ne ( 'dancing monkeys' ) . build ( ) ;
74
+ const cn = new Condition ( )
75
+ . prop ( 'my_prop' )
76
+ . ne ( 'dancing monkeys' )
77
+ . build ( ) ;
66
78
expect ( cn ) . toBe ( '["my_prop"] != "dancing monkeys"' ) ;
67
79
} ) ;
68
80
69
81
it ( 'builds less than condition' , ( ) => {
70
- const cn = new Condition ( ) . prop ( 'my_prop' ) . lt ( 299792458 ) . build ( ) ;
82
+ const cn = new Condition ( )
83
+ . prop ( 'my_prop' )
84
+ . lt ( 299792458 )
85
+ . build ( ) ;
71
86
expect ( cn ) . toBe ( '["my_prop"] < 299792458' ) ;
72
87
} ) ;
73
88
74
89
it ( 'builds less than or equal to condition' , ( ) => {
75
- const cn = new Condition ( ) . prop ( 'my_prop' ) . lte ( 299792458 ) . build ( ) ;
90
+ const cn = new Condition ( )
91
+ . prop ( 'my_prop' )
92
+ . lte ( 299792458 )
93
+ . build ( ) ;
76
94
expect ( cn ) . toBe ( '["my_prop"] <= 299792458' ) ;
77
95
} ) ;
78
96
79
97
it ( 'builds greater than condition' , ( ) => {
80
- const cn = new Condition ( ) . prop ( 'my_prop' ) . gt ( 299792458 ) . build ( ) ;
98
+ const cn = new Condition ( )
99
+ . prop ( 'my_prop' )
100
+ . gt ( 299792458 )
101
+ . build ( ) ;
81
102
expect ( cn ) . toBe ( '["my_prop"] > 299792458' ) ;
82
103
} ) ;
83
104
84
105
it ( 'builds greater than or equal to condition' , ( ) => {
85
- const cn = new Condition ( ) . prop ( 'my_prop' ) . gte ( 299792458 ) . build ( ) ;
106
+ const cn = new Condition ( )
107
+ . prop ( 'my_prop' )
108
+ . gte ( 299792458 )
109
+ . build ( ) ;
86
110
expect ( cn ) . toBe ( '["my_prop"] >= 299792458' ) ;
87
111
} ) ;
88
112
89
113
it ( 'builds property exists condition' , ( ) => {
90
- const cn = new Condition ( ) . prop ( 'one_piece' ) . exists ( ) . build ( ) ;
114
+ const cn = new Condition ( )
115
+ . prop ( 'one_piece' )
116
+ . exists ( )
117
+ . build ( ) ;
91
118
expect ( cn ) . toBe ( '["one_piece"] exists' ) ;
92
119
} ) ;
93
120
94
121
it ( 'builds property missing condition' , ( ) => {
95
- const cn = new Condition ( ) . prop ( 'the_last_airbender' ) . missing ( ) . build ( ) ;
122
+ const cn = new Condition ( )
123
+ . prop ( 'the_last_airbender' )
124
+ . missing ( )
125
+ . build ( ) ;
96
126
expect ( cn ) . toBe ( '["the_last_airbender"] missing' ) ;
97
127
} ) ;
98
128
99
129
it ( 'builds contains condition' , ( ) => {
100
- const cn = new Condition ( ) . prop ( 'potion' ) . contains ( 'magic' ) . build ( ) ;
130
+ const cn = new Condition ( )
131
+ . prop ( 'potion' )
132
+ . contains ( 'magic' )
133
+ . build ( ) ;
101
134
expect ( cn ) . toBe ( '["potion"] contains "magic"' ) ;
102
135
} ) ;
103
136
104
137
it ( 'builds notcontains condition' , ( ) => {
105
- const cn = new Condition ( ) . prop ( 'anime' ) . notContains ( 'fillers' ) . build ( ) ;
138
+ const cn = new Condition ( )
139
+ . prop ( 'anime' )
140
+ . notContains ( 'fillers' )
141
+ . build ( ) ;
106
142
expect ( cn ) . toBe ( '["anime"] !contains "fillers"' ) ;
107
143
} ) ;
108
144
0 commit comments