(t *testing.T)
| 478 | } |
| 479 | |
| 480 | func TestSharedState_SetGet_RawDataKinds(t *testing.T) { |
| 481 | t.Parallel() |
| 482 | |
| 483 | app := New(Config{SharedStorage: newSharedStateMemoryStorage(t)}) |
| 484 | |
| 485 | testCases := []struct { |
| 486 | key string |
| 487 | value []byte |
| 488 | }{ |
| 489 | {key: "plain", value: []byte("text")}, |
| 490 | {key: "json", value: []byte(`{"id":42}`)}, |
| 491 | {key: "binary", value: []byte{0x00, 0xFF, 0x10, 0x7F}}, |
| 492 | } |
| 493 | |
| 494 | for _, tc := range testCases { |
| 495 | t.Run(tc.key, func(t *testing.T) { |
| 496 | t.Parallel() |
| 497 | |
| 498 | require.NoError(t, app.SharedState().Set(tc.key, tc.value, time.Minute)) |
| 499 | |
| 500 | got, found, err := app.SharedState().Get(tc.key) |
| 501 | require.NoError(t, err) |
| 502 | require.True(t, found) |
| 503 | require.Equal(t, tc.value, got) |
| 504 | }) |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | func TestSharedState_SetGet_JSONDataKinds(t *testing.T) { |
| 509 | t.Parallel() |
nothing calls this directly
no test coverage detected