github.com/iotexproject/iotex-core@v1.14.1-rc1/action/const_test.go (about) 1 // Copyright (c) 2021 IoTeX Foundation 2 // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 6 package action 7 8 import ( 9 "testing" 10 11 "github.com/stretchr/testify/require" 12 ) 13 14 func TestLoadErrorDescription(t *testing.T) { 15 request := require.New(t) 16 tests := []struct { 17 err error 18 ret string 19 }{ 20 {ErrOversizedData, ErrOversizedData.Error()}, 21 {ErrTxPoolOverflow, ErrTxPoolOverflow.Error()}, 22 {ErrInvalidSender, ErrInvalidSender.Error()}, 23 {ErrNonceTooHigh, ErrNonceTooHigh.Error()}, 24 {ErrInsufficientFunds, ErrInsufficientFunds.Error()}, 25 {ErrIntrinsicGas, ErrIntrinsicGas.Error()}, 26 {ErrChainID, ErrChainID.Error()}, 27 {ErrNotFound, ErrNotFound.Error()}, 28 {ErrVotee, ErrVotee.Error()}, 29 {ErrAddress, ErrAddress.Error()}, 30 {ErrExistedInPool, ErrExistedInPool.Error()}, 31 {ErrReplaceUnderpriced, ErrReplaceUnderpriced.Error()}, 32 {ErrNonceTooLow, ErrNonceTooLow.Error()}, 33 {ErrUnderpriced, ErrUnderpriced.Error()}, 34 {ErrNonceTooHigh, ErrNonceTooHigh.Error()}, 35 {ErrAddress, ErrAddress.Error()}, 36 {ErrNegativeValue, ErrNegativeValue.Error()}, 37 {ErrNilAction, "Unknown"}, 38 {ErrNilProto, "Unknown"}, 39 } 40 for _, e := range tests { 41 request.Equal(e.ret, LoadErrorDescription(e.err)) 42 } 43 }