-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors_test.go
32 lines (27 loc) · 975 Bytes
/
errors_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package mcms
import (
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/assert"
)
func TestErrorMessages(t *testing.T) {
t.Parallel()
tests := []struct {
err error
want string
}{
{NewEncoderNotFoundError(1), "encoder not provided for chain selector 1"},
{NewChainMetadataNotFoundError(1), "missing metadata for chain 1"},
{NewInconsistentConfigsError(1, 2), "inconsistent configs for chains 1 and 2"},
{NewQuorumNotReachedError(1), "quorum not reached for chain 1"},
{NewInvalidValidUntilError(1), "invalid valid until: 1"},
{NewInvalidSignatureError(common.HexToAddress("0x1")), "invalid signature: received signature for address 0x0000000000000000000000000000000000000001 is not a valid signer in the MCMS proposal"},
{NewQuorumNotReachedError(1), "quorum not reached for chain 1"},
}
for _, tt := range tests {
got := tt.err.Error()
if got != tt.want {
assert.Equal(t, tt.want, tt.err.Error())
}
}
}