MCPcopy
hub / github.com/gofiber/fiber / TestSharedState_GetJSON_UnmarshalError

Function TestSharedState_GetJSON_UnmarshalError

shared_state_test.go:424–438  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

422}
423
424func TestSharedState_GetJSON_UnmarshalError(t *testing.T) {
425 t.Parallel()
426
427 store := newSharedStateMemoryStorage(t)
428 app := New(Config{SharedStorage: store})
429
430 storageKey, ok := app.SharedState().storageKey("broken")
431 require.True(t, ok)
432 require.NoError(t, store.Set(storageKey, []byte("{"), 0))
433
434 var out map[string]any
435 _, found, err := app.SharedState().GetJSON("broken", &out)
436 require.False(t, found)
437 require.Error(t, err)
438}
439
440func TestSharedState_Get_ReturnsCopy(t *testing.T) {
441 t.Parallel()

Callers

nothing calls this directly

Calls 7

storageKeyMethod · 0.80
SharedStateMethod · 0.80
GetJSONMethod · 0.80
NewFunction · 0.70
SetMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected