prysm-pulse/beacon-chain/state/testing/getters_validator.go
Leo Lara 1835f54197
Refactor for DRY state getters_validator_test and getters_test (#10117)
* Refactor for DRY state getters_validator_test and getters_test

* Add BUILD.bazel to beacon-chain/state/testing

* Handle type assertion error in beacon-chain/state tests

* Fix with gazelle

Co-authored-by: Nishant Das <nishdas93@gmail.com>
2022-02-11 14:48:29 +08:00

20 lines
484 B
Go

package testing
import (
"testing"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
)
type getState func() (state.BeaconState, error)
func VerifyBeaconState_ValidatorAtIndexReadOnly_HandlesNilSlice(t *testing.T, factory getState) {
st, err := factory()
require.NoError(t, err)
_, err = st.ValidatorAtIndexReadOnly(0)
assert.Equal(t, state.ErrNilValidatorsInState, err)
}