2024-03-17 09:10:05 +00:00
|
|
|
package bitcoinity_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
_ "embed"
|
|
|
|
"encoding/json"
|
|
|
|
"testing"
|
|
|
|
|
2024-03-19 21:29:37 +00:00
|
|
|
"code.humancabbage.net/sam/moonmath/bitcoinity"
|
2024-03-17 09:10:05 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|