Move Bitcoinity websocket capture, and test it.
All checks were successful
Build & Test / Main (push) Successful in 57s
All checks were successful
Build & Test / Main (push) Successful in 57s
This commit is contained in:
parent
52508b7d4e
commit
ac1a4bc16c
@ -21,3 +21,24 @@ func TestUnmarshalGetTickerResponse(t *testing.T) {
|
||||
|
||||
//go:embed get_ticker.json
|
||||
var getTickerJson []byte
|
||||
|
||||
func TestUnmarshalWebhookMessages(t *testing.T) {
|
||||
var msgs []bitcoinity.Message
|
||||
err := json.Unmarshal(capturedJson, &msgs)
|
||||
if err != nil {
|
||||
t.Errorf("failed to unmarshal webhook messages JSON: %v", err)
|
||||
}
|
||||
for _, msg := range msgs {
|
||||
if msg.Event != "new_msg" {
|
||||
continue
|
||||
}
|
||||
var payload bitcoinity.MarketPayload
|
||||
err := json.Unmarshal(msg.Payload, &payload)
|
||||
if err != nil {
|
||||
t.Errorf("failed to unmarshal market payload JSON: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//go:embed captured.json
|
||||
var capturedJson []byte
|
||||
|
Loading…
Reference in New Issue
Block a user