You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
364 B

  1. package jsonrpc
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/intel-go/fastjson"
  6. "github.com/stretchr/testify/require"
  7. )
  8. func TestRequestID(t *testing.T) {
  9. c := context.Background()
  10. id := fastjson.RawMessage("1")
  11. c = WithRequestID(c, &id)
  12. var pick *fastjson.RawMessage
  13. require.NotPanics(t, func() {
  14. pick = RequestID(c)
  15. })
  16. require.Equal(t, &id, pick)
  17. }