moonmath/bitcoinity/model_test.go
Sam Fredrickson 83fd89446d
All checks were successful
Build & Test / Main (push) Successful in 1m20s
Fix module name.
2024-03-19 14:29:37 -07:00

24 lines
500 B
Go

package bitcoinity_test
import (
_ "embed"
"encoding/json"
"testing"
"code.humancabbage.net/sam/moonmath/bitcoinity"
)
func TestUnmarshalGetTickerResponse(t *testing.T) {
var resp bitcoinity.GetTickerResponse
err := json.Unmarshal(getTickerJson, &resp)
if err != nil {
t.Errorf("failed to unmarshal get_ticker JSON: %v", err)
}
if resp.TickerLife != 604800 {
t.Errorf("expected TickerLife == 604800, not %v", resp.TickerLife)
}
}
//go:embed get_ticker.json
var getTickerJson []byte