mirror of
https://github.com/luxfi/utxo.git
synced 2026-07-27 03:39:23 +00:00
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package nftfx
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/luxfi/utxo/secp256k1fx"
|
|
"github.com/luxfi/vm/components/verify"
|
|
)
|
|
|
|
func TestMintOperationVerifyNil(t *testing.T) {
|
|
op := (*MintOperation)(nil)
|
|
err := op.Verify()
|
|
require.ErrorIs(t, err, errNilMintOperation)
|
|
}
|
|
|
|
func TestMintOperationVerifyTooLargePayload(t *testing.T) {
|
|
op := MintOperation{
|
|
Payload: make([]byte, MaxPayloadSize+1),
|
|
}
|
|
err := op.Verify()
|
|
require.ErrorIs(t, err, errPayloadTooLarge)
|
|
}
|
|
|
|
func TestMintOperationVerifyInvalidOutput(t *testing.T) {
|
|
op := MintOperation{
|
|
Outputs: []*secp256k1fx.OutputOwners{{
|
|
Threshold: 1,
|
|
}},
|
|
}
|
|
err := op.Verify()
|
|
require.ErrorIs(t, err, secp256k1fx.ErrOutputUnspendable)
|
|
}
|
|
|
|
func TestMintOperationOuts(t *testing.T) {
|
|
op := MintOperation{
|
|
Outputs: []*secp256k1fx.OutputOwners{{}},
|
|
}
|
|
require.Len(t, op.Outs(), 1)
|
|
}
|
|
|
|
func TestMintOperationState(t *testing.T) {
|
|
intf := interface{}(&MintOperation{})
|
|
_, ok := intf.(verify.State)
|
|
require.False(t, ok)
|
|
}
|