Skip to content

Commit bec6603

Browse files
committed
refactoring of test
1 parent 09313b6 commit bec6603

File tree

1 file changed

+46
-40
lines changed

1 file changed

+46
-40
lines changed

params_test.go

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -229,32 +229,35 @@ func TestParamsFromMap(t *testing.T) {
229229
})
230230
pp, err := params.ToYDB(&allocator.Allocator{})
231231
require.NoError(t, err)
232-
require.EqualValues(t, map[string]*Ydb.TypedValue{
233-
"$a": {
234-
Type: &Ydb.Type{
235-
Type: &Ydb.Type_TypeId{
236-
TypeId: Ydb.Type_TIMESTAMP,
232+
require.EqualValues(t,
233+
fmt.Sprintf("%+v", map[string]*Ydb.TypedValue{
234+
"$a": {
235+
Type: &Ydb.Type{
236+
Type: &Ydb.Type_TypeId{
237+
TypeId: Ydb.Type_TIMESTAMP,
238+
},
237239
},
238-
},
239-
Value: &Ydb.Value{
240-
Value: &Ydb.Value_Uint64Value{
241-
Uint64Value: 123000000,
240+
Value: &Ydb.Value{
241+
Value: &Ydb.Value_Uint64Value{
242+
Uint64Value: 123000000,
243+
},
242244
},
243245
},
244-
},
245-
"$b": {
246-
Type: &Ydb.Type{
247-
Type: &Ydb.Type_TypeId{
248-
TypeId: Ydb.Type_INTERVAL,
246+
"$b": {
247+
Type: &Ydb.Type{
248+
Type: &Ydb.Type_TypeId{
249+
TypeId: Ydb.Type_INTERVAL,
250+
},
249251
},
250-
},
251-
Value: &Ydb.Value{
252-
Value: &Ydb.Value_Int64Value{
253-
Int64Value: 123,
252+
Value: &Ydb.Value{
253+
Value: &Ydb.Value_Int64Value{
254+
Int64Value: 123,
255+
},
254256
},
255257
},
256-
},
257-
}, pp)
258+
}),
259+
fmt.Sprintf("%+v", pp),
260+
)
258261
})
259262
t.Run("BindWideTimeTypes", func(t *testing.T) {
260263
params := ydb.ParamsFromMap(map[string]any{
@@ -263,32 +266,35 @@ func TestParamsFromMap(t *testing.T) {
263266
}, ydb.WithWideTimeTypes(true))
264267
pp, err := params.ToYDB(&allocator.Allocator{})
265268
require.NoError(t, err)
266-
require.EqualValues(t, map[string]*Ydb.TypedValue{
267-
"$a": {
268-
Type: &Ydb.Type{
269-
Type: &Ydb.Type_TypeId{
270-
TypeId: Ydb.Type_TIMESTAMP64,
269+
require.EqualValues(t,
270+
fmt.Sprintf("%+v", map[string]*Ydb.TypedValue{
271+
"$a": {
272+
Type: &Ydb.Type{
273+
Type: &Ydb.Type_TypeId{
274+
TypeId: Ydb.Type_TIMESTAMP64,
275+
},
271276
},
272-
},
273-
Value: &Ydb.Value{
274-
Value: &Ydb.Value_Int64Value{
275-
Int64Value: -2208988799999877,
277+
Value: &Ydb.Value{
278+
Value: &Ydb.Value_Int64Value{
279+
Int64Value: -2208988799999877,
280+
},
276281
},
277282
},
278-
},
279-
"$b": {
280-
Type: &Ydb.Type{
281-
Type: &Ydb.Type_TypeId{
282-
TypeId: Ydb.Type_INTERVAL64,
283+
"$b": {
284+
Type: &Ydb.Type{
285+
Type: &Ydb.Type_TypeId{
286+
TypeId: Ydb.Type_INTERVAL64,
287+
},
283288
},
284-
},
285-
Value: &Ydb.Value{
286-
Value: &Ydb.Value_Int64Value{
287-
Int64Value: 123,
289+
Value: &Ydb.Value{
290+
Value: &Ydb.Value_Int64Value{
291+
Int64Value: 123,
292+
},
288293
},
289294
},
290-
},
291-
}, pp)
295+
}),
296+
fmt.Sprintf("%+v", pp),
297+
)
292298
})
293299
t.Run("WrongBindings", func(t *testing.T) {
294300
params := ydb.ParamsFromMap(map[string]any{

0 commit comments

Comments
 (0)