mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-04 19:02:28 +00:00
tests: replace t.Fatal with require where possible
This makes tests less verbose and unifies the style they are written in.
This commit is contained in:
parent
66f96e3f32
commit
a3dacd3b74
14 changed files with 52 additions and 120 deletions
|
@ -6,18 +6,15 @@ import (
|
|||
"github.com/CityOfZion/neo-go/config"
|
||||
"github.com/CityOfZion/neo-go/pkg/encoding/address"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGenesisBlockMainNet(t *testing.T) {
|
||||
cfg, err := config.Load("../../config", config.ModeMainNet)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
block, err := createGenesisBlock(cfg.ProtocolConfiguration)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
expect := "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"
|
||||
assert.Equal(t, expect, block.Hash().StringLE())
|
||||
|
@ -30,19 +27,13 @@ func TestGetConsensusAddressMainNet(t *testing.T) {
|
|||
)
|
||||
|
||||
cfg, err := config.Load("../../config", config.ModeMainNet)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
validators, err := getValidators(cfg.ProtocolConfiguration)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
script, err := getNextConsensusAddress(validators)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, consensusScript, script.String())
|
||||
assert.Equal(t, consensusAddr, address.Uint160ToString(script))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue