2121)
2222
2323func TestBooleanEvaluation (t * testing.T ) {
24- flattenedContext := map [string ]interface {} {}
24+ flattenedContext := map [string ]any {}
2525
2626 resolution := provider .BooleanEvaluation (context .Background (), "sample_bool" , false , flattenedContext )
2727 if resolution .Value != true {
@@ -35,7 +35,7 @@ func TestBooleanEvaluation(t *testing.T) {
3535
3636 evalCtx := of .NewEvaluationContext (
3737 "" ,
38- map [string ]interface {} {},
38+ map [string ]any {},
3939 )
4040 enabled , err := ofClient .BooleanValue (context .Background (), "sample_bool" , false , evalCtx )
4141 require .Nil (t , err )
@@ -78,7 +78,7 @@ func TestBooleanEvaluation(t *testing.T) {
7878// }
7979
8080func TestFloatEvaluation (t * testing.T ) {
81- flattenedContext := map [string ]interface {} {}
81+ flattenedContext := map [string ]any {}
8282
8383 resolution := provider .FloatEvaluation (context .Background (), "sample_double" , 1.2 , flattenedContext )
8484 if resolution .Value != 12.12 {
@@ -92,15 +92,15 @@ func TestFloatEvaluation(t *testing.T) {
9292
9393 evalCtx := of .NewEvaluationContext (
9494 "" ,
95- map [string ]interface {} {},
95+ map [string ]any {},
9696 )
9797 value , err := ofClient .FloatValue (context .Background (), "sample_double" , 1.2 , evalCtx )
9898 require .Nil (t , err )
9999 require .Equal (t , 12.12 , value )
100100}
101101
102102func TestIntEvaluation (t * testing.T ) {
103- flattenedContext := map [string ]interface {} {}
103+ flattenedContext := map [string ]any {}
104104
105105 resolution := provider .IntEvaluation (context .Background (), "sample_int" , 1 , flattenedContext )
106106 if resolution .Value != 123 {
@@ -114,15 +114,15 @@ func TestIntEvaluation(t *testing.T) {
114114
115115 evalCtx := of .NewEvaluationContext (
116116 "" ,
117- map [string ]interface {} {},
117+ map [string ]any {},
118118 )
119119 value , err := ofClient .IntValue (context .Background (), "sample_int" , 1 , evalCtx )
120120 require .Nil (t , err )
121121 require .Equal (t , int64 (123 ), value )
122122}
123123
124124func TestStringEvaluation (t * testing.T ) {
125- flattenedContext := map [string ]interface {} {}
125+ flattenedContext := map [string ]any {}
126126
127127 resolution := provider .StringEvaluation (context .Background (), "sample" , "default" , flattenedContext )
128128 if resolution .Value != "test sample value" {
@@ -136,7 +136,7 @@ func TestStringEvaluation(t *testing.T) {
136136
137137 evalCtx := of .NewEvaluationContext (
138138 "" ,
139- map [string ]interface {} {},
139+ map [string ]any {},
140140 )
141141 value , err := ofClient .StringValue (context .Background (), "sample" , "default" , evalCtx )
142142 require .Nil (t , err )
@@ -145,7 +145,7 @@ func TestStringEvaluation(t *testing.T) {
145145
146146// TODO test and enable when json/yaml parsing is implemented
147147func TestObjectEvaluation (t * testing.T ) {
148- flattenedContext := map [string ]interface {} {}
148+ flattenedContext := map [string ]any {}
149149
150150 t .Run ("example.nested.path" , func (t * testing.T ) {
151151 resolution := provider .ObjectEvaluation (context .Background (), "example.nested.path" , "default" , flattenedContext )
@@ -154,7 +154,7 @@ func TestObjectEvaluation(t *testing.T) {
154154
155155 evalCtx := of .NewEvaluationContext (
156156 "" ,
157- map [string ]interface {} {},
157+ map [string ]any {},
158158 )
159159
160160 t .Run ("example.nested.path" , func (t * testing.T ) {
@@ -187,11 +187,11 @@ func TestConvertsNonEmptyFlattenedContextToContextSet(t *testing.T) {
187187 "device.type" : "mobile" ,
188188 }
189189 expected := prefab .NewContextSet ()
190- expected .WithNamedContextValues ("user" , map [string ]interface {} {
190+ expected .WithNamedContextValues ("user" , map [string ]any {
191191 "name" : "John" ,
192192 "age" : 30 ,
193193 })
194- expected .WithNamedContextValues ("device" , map [string ]interface {} {
194+ expected .WithNamedContextValues ("device" , map [string ]any {
195195 "type" : "mobile" ,
196196 })
197197
@@ -204,7 +204,7 @@ func TestConvertsNonEmptyFlattenedContextToContextSet(t *testing.T) {
204204}
205205
206206func TestUninitializedProviderStates (t * testing.T ) {
207- flattenedContext := map [string ]interface {} {}
207+ flattenedContext := map [string ]any {}
208208
209209 providerConfig := prefabProvider.ProviderConfig {
210210 Sources : []string {"datafile://enabled.yaml" },
@@ -228,7 +228,7 @@ func TestUninitializedProviderStates(t *testing.T) {
228228}
229229
230230func TestErrorProviderStates (t * testing.T ) {
231- flattenedContext := map [string ]interface {} {}
231+ flattenedContext := map [string ]any {}
232232
233233 providerConfig := prefabProvider.ProviderConfig {
234234 Sources : []string {"datafile://non-existing.yaml" },
@@ -264,16 +264,16 @@ func TestEvaluationMethods(t *testing.T) {
264264
265265 evalCtx := of .NewEvaluationContext (
266266 "" ,
267- map [string ]interface {} {
267+ map [string ]any {
268268 "user.id" : "123" ,
269269 },
270270 )
271271
272272 tests := []struct {
273273 flag string
274- defaultValue interface {}
274+ defaultValue any
275275 evalCtx of.EvaluationContext
276- expected interface {}
276+ expected any
277277 expectedErrorCode of.ErrorCode
278278 }{
279279 {"sample_bool" , false , evalCtx , true , "" },
@@ -285,25 +285,25 @@ func TestEvaluationMethods(t *testing.T) {
285285 {"sample_list" , []string {"fallback1" , "fallback2" }, evalCtx , []string {"a" , "b" }, "" },
286286 {"invalid_user_context_bool" , false , of .NewEvaluationContext (
287287 "" ,
288- map [string ]interface {} {
288+ map [string ]any {
289289 "invalid" : "123" ,
290290 },
291291 ), false , of .InvalidContextCode },
292292 {"invalid_user_context_int" , int64 (43 ), of .NewEvaluationContext (
293293 "" ,
294- map [string ]interface {} {
294+ map [string ]any {
295295 "invalid" : "123" ,
296296 },
297297 ), int64 (43 ), of .InvalidContextCode },
298298 {"invalid_user_context_float" , 1.2 , of .NewEvaluationContext (
299299 "" ,
300- map [string ]interface {} {
300+ map [string ]any {
301301 "invalid" : "123" ,
302302 },
303303 ), 1.2 , of .InvalidContextCode },
304304 {"invalid_user_context_string" , "a" , of .NewEvaluationContext (
305305 "" ,
306- map [string ]interface {} {
306+ map [string ]any {
307307 "invalid" : "123" ,
308308 },
309309 ), "a" , of .InvalidContextCode },
0 commit comments