|
| 1 | +/* |
| 2 | + * Copyright (c) 2018 LI Zhennan |
| 3 | + * |
| 4 | + * Use of this work is governed by a MIT License. |
| 5 | + * You may find a license copy in project root. |
| 6 | + */ |
| 7 | + |
| 8 | +package etherscan |
| 9 | + |
| 10 | +import ( |
| 11 | + "testing" |
| 12 | +) |
| 13 | + |
| 14 | +//GasEstiamte generates dynamic data. Best we can do is ensure all fields are populated |
| 15 | +func TestClient_GasEstimate(t *testing.T) { |
| 16 | + confirmationTime, err := api.GasEstimate(20000000) |
| 17 | + noError(t, err, "api.GasEstimate") |
| 18 | + |
| 19 | + if 0 == len(confirmationTime) { |
| 20 | + t.Errorf("confirmationTime empty string") |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | +//GasOracle generates dynamic data. Best we can do is ensure all fields are populated |
| 25 | +func TestClient_GasOracle(t *testing.T) { |
| 26 | + gasPrice, err := api.GasOracle() |
| 27 | + noError(t, err, "api.GasOrcale") |
| 28 | + |
| 29 | + if 0 == len(gasPrice.LastBlock) { |
| 30 | + t.Errorf("gasPrice.LastBlock empty string") |
| 31 | + } |
| 32 | + |
| 33 | + if 0 == len(gasPrice.SafeGasPrice) { |
| 34 | + t.Errorf("gasPrice.SafeGasPrice empty string") |
| 35 | + } |
| 36 | + |
| 37 | + if 0 == len(gasPrice.ProposeGasPrice) { |
| 38 | + t.Errorf("gasPrice.ProposeGasPrice empty string") |
| 39 | + } |
| 40 | + |
| 41 | + if 0 == len(gasPrice.FastGasPrice) { |
| 42 | + t.Errorf("gasPrice.FastGasPrice empty string") |
| 43 | + } |
| 44 | + |
| 45 | + if 0 == len(gasPrice.SuggestBaseFeeInGwei) { |
| 46 | + t.Errorf("gasPrice.SuggestBaseFeeInGwei empty string") |
| 47 | + } |
| 48 | + |
| 49 | + if 0 == len(gasPrice.GasUsedRatio) { |
| 50 | + t.Errorf("gasPrice.GasUsedRatio empty string") |
| 51 | + } |
| 52 | + |
| 53 | +} |
0 commit comments