github.com/bitfinexcom/bitfinex-api-go@v0.0.0-20210608095005-9e0b26f200fb/pkg/models/fundingoffer/submit_test.go (about)

     1  package fundingoffer_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/bitfinexcom/bitfinex-api-go/pkg/models/fundingoffer"
     7  	"github.com/stretchr/testify/assert"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestSubmitRequest(t *testing.T) {
    12  	t.Run("MarshalJSON", func(t *testing.T) {
    13  		fosr := fundingoffer.SubmitRequest{
    14  			Type:   "LIMIT",
    15  			Symbol: "fETH",
    16  			Amount: 0.29797676,
    17  			Rate:   0.0002,
    18  			Period: 2,
    19  		}
    20  		got, err := fosr.MarshalJSON()
    21  		require.Nil(t, err)
    22  
    23  		expected := "[0, \"fon\", null, {\"type\":\"LIMIT\",\"symbol\":\"fETH\",\"amount\":\"0.29797676\",\"rate\":\"0.0002\",\"period\":2}]"
    24  		assert.Equal(t, expected, string(got))
    25  	})
    26  }