MCPcopy Create free account
hub / github.com/gavv/httpexpect / TestValue_GetObject

Function TestValue_GetObject

value_test.go:286–323  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

284}
285
286func TestValue_GetObject(t *testing.T) {
287 type myMap map[string]interface{}
288
289 cases := []struct {
290 name string
291 data interface{}
292 result chainResult
293 expectedObject map[string]interface{}
294 }{
295 {
296 name: "map",
297 data: map[string]interface{}{"foo": 123.0},
298 result: success,
299 expectedObject: map[string]interface{}{"foo": 123.0},
300 },
301 {
302 name: "myMap",
303 data: myMap{"foo": 123.0},
304 result: success,
305 expectedObject: map[string]interface{}(myMap{"foo": 123.0}),
306 },
307 }
308
309 for _, tc := range cases {
310 t.Run(tc.name, func(t *testing.T) {
311 reporter := newMockReporter(t)
312
313 value := NewValue(reporter, tc.data)
314 inner := value.Object()
315
316 inner.chain.assert(t, tc.result)
317
318 if tc.result {
319 assert.Equal(t, tc.expectedObject, inner.Raw())
320 }
321 })
322 }
323}
324
325func TestValue_GetArray(t *testing.T) {
326 type myArray []interface{}

Callers

nothing calls this directly

Calls 6

ObjectMethod · 0.95
newMockReporterFunction · 0.85
NewValueFunction · 0.85
assertMethod · 0.80
EqualMethod · 0.45
RawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…