mirror of
https://github.com/luxfi/proto.git
synced 2026-10-30 15:21:09 +00:00
40 lines
641 B
Go
40 lines
641 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package txs
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/luxfi/constants"
|
|
"github.com/luxfi/ids"
|
|
)
|
|
|
|
func TestChainValidatorVerifyChainID(t *testing.T) {
|
|
require := require.New(t)
|
|
|
|
// Error path
|
|
{
|
|
vdr := &ChainValidator{
|
|
Chain: constants.PrimaryNetworkID,
|
|
}
|
|
|
|
err := vdr.Verify()
|
|
require.ErrorIs(err, errBadChainID)
|
|
}
|
|
|
|
// Happy path
|
|
{
|
|
vdr := &ChainValidator{
|
|
Chain: ids.GenerateTestID(),
|
|
Validator: Validator{
|
|
Wght: 1,
|
|
},
|
|
}
|
|
|
|
require.NoError(vdr.Verify())
|
|
}
|
|
}
|