github.com/MetalBlockchain/metalgo@v1.11.9/snow/engine/common/request_test.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package common
     5  
     6  import (
     7  	"encoding/json"
     8  	"testing"
     9  
    10  	"github.com/stretchr/testify/require"
    11  
    12  	"github.com/MetalBlockchain/metalgo/ids"
    13  )
    14  
    15  func TestRequestJSONMarshal(t *testing.T) {
    16  	requestMap := map[Request]ids.ID{
    17  		{
    18  			NodeID:    ids.GenerateTestNodeID(),
    19  			RequestID: 12345,
    20  		}: ids.GenerateTestID(),
    21  	}
    22  	_, err := json.Marshal(requestMap)
    23  	require.NoError(t, err)
    24  }