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

     1  package pulseprofile_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/bitfinexcom/bitfinex-api-go/pkg/models/pulseprofile"
     7  	"github.com/stretchr/testify/assert"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestNewProfileFromRaw(t *testing.T) {
    12  	t.Run("insufficient arguments", func(t *testing.T) {
    13  		payload := []interface{}{"abc123"}
    14  		pp, err := pulseprofile.NewFromRaw(payload)
    15  		require.NotNil(t, err)
    16  		require.Nil(t, pp)
    17  	})
    18  
    19  	t.Run("sufficient arguments", func(t *testing.T) {
    20  		payload := []interface{}{
    21  			"bf324e24-5a09-4317-b418-6c37281ab855",
    22  			1591614631576,
    23  			nil,
    24  			"Bitfinex",
    25  			nil,
    26  			"image-33533a4d-a796-4afe-9b8b-690bc7075e05-1587476823358-size.png",
    27  			"Bitfinex is the world’s leading digital asset trading platform.",
    28  			nil,
    29  			nil,
    30  			"bitfinex",
    31  			nil,
    32  			40,
    33  			5,
    34  			nil,
    35  			nil,
    36  			nil,
    37  			0,
    38  		}
    39  
    40  		pp, err := pulseprofile.NewFromRaw(payload)
    41  		require.Nil(t, err)
    42  
    43  		expected := &pulseprofile.PulseProfile{
    44  			ID:            "bf324e24-5a09-4317-b418-6c37281ab855",
    45  			MTS:           1591614631576,
    46  			Nickname:      "Bitfinex",
    47  			Picture:       "image-33533a4d-a796-4afe-9b8b-690bc7075e05-1587476823358-size.png",
    48  			Text:          "Bitfinex is the world’s leading digital asset trading platform.",
    49  			TwitterHandle: "bitfinex",
    50  			Followers:     40,
    51  			Following:     5,
    52  			TippingStatus: 0,
    53  		}
    54  		assert.Equal(t, expected, pp)
    55  	})
    56  }