Skip to content

Commit

Permalink
Linter issue
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Dec 9, 2021
1 parent 8430f92 commit 778efb6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions websocket/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ import (
func TestOrderBookMessageBid(t *testing.T) {
bidMessage := `[336,{"b":[["50251.20000","0.00000000","1638472269.482087"],["47190.00000","0.01000000","1638216666.203784","r"]],"c":"2271011438"},"book-1000","XBT/EUR"]`
var msg Message
err := json.Unmarshal([]byte(bidMessage), &msg)
if err := json.Unmarshal([]byte(bidMessage), &msg); err != nil {
t.Error("could not parse message:", err)
return
}

var update OrderBookUpdate
err = json.Unmarshal(msg.Data, &update)
if err != nil {
if err := json.Unmarshal(msg.Data, &update); err != nil {
t.Error("could not parse message:", err)
return
}
if len(update.Asks) != 0 {
t.Error("expected 0 asks, got", len(update.Asks))
Expand All @@ -26,15 +29,16 @@ func TestOrderBookMessageBid(t *testing.T) {
func TestOrderBookMessageAskBid(t *testing.T) {
askBidMessage := `[336,{"a":[["51982.90000","0.00000000","1638471905.000103"],["53700.00000","0.30322268","1638286260.153968","r"]]},{"b":[["48489.80000","0.00000000","1638471905.000059"],["47112.00000","0.00212260","1638286104.076640","r"]],"c":"2144637680"},"book-1000","XBT/EUR"]`
var msg Message
err := json.Unmarshal([]byte(askBidMessage), &msg)
if err != nil {

if err := json.Unmarshal([]byte(askBidMessage), &msg); err != nil {
t.Error("could not parse message:", err)
return
}

var update OrderBookUpdate
err = json.Unmarshal(msg.Data, &update)
if err != nil {
if err := json.Unmarshal(msg.Data, &update); err != nil {
t.Error("could not parse order book update:", err)
return
}
if len(update.Asks) != 2 {
t.Error("expected 2 asks, got", len(update.Asks))
Expand Down

0 comments on commit 778efb6

Please sign in to comment.