Skip to content

Commit

Permalink
chore: cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jadwahab committed Mar 29, 2023
1 parent d41610e commit da68c79
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 159 deletions.
92 changes: 23 additions & 69 deletions tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@ import (
"github.com/stretchr/testify/require"
)

var FQPoint5SatPerByte = bt.NewFeeQuote().
AddQuote(bt.FeeTypeStandard, &bt.Fee{
FeeType: bt.FeeTypeStandard,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
}).AddQuote(bt.FeeTypeData, &bt.Fee{
FeeType: bt.FeeTypeData,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
})

func TestNewTx(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -545,29 +568,6 @@ func TestTx_Clone(t *testing.T) {
})
}
func Test_EstimateIsFeePaidEnough(t *testing.T) {
FQPoint5SatPerByte := bt.NewFeeQuote().
AddQuote(bt.FeeTypeStandard, &bt.Fee{
FeeType: bt.FeeTypeStandard,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
}).AddQuote(bt.FeeTypeData, &bt.Fee{
FeeType: bt.FeeTypeData,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
})

tests := map[string]struct {
tx *bt.Tx
dataLength uint64
Expand Down Expand Up @@ -761,29 +761,6 @@ func Test_EstimateIsFeePaidEnough(t *testing.T) {
}

func Test_IsFeePaidEnough(t *testing.T) {
FQPoint5SatPerByte := bt.NewFeeQuote().
AddQuote(bt.FeeTypeStandard, &bt.Fee{
FeeType: bt.FeeTypeStandard,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
}).AddQuote(bt.FeeTypeData, &bt.Fee{
FeeType: bt.FeeTypeData,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
})

tests := map[string]struct {
tx *bt.Tx
dataLength uint64
Expand Down Expand Up @@ -963,29 +940,6 @@ func Test_IsFeePaidEnough(t *testing.T) {
}

func Test_EstimateFeesPaid(t *testing.T) {
FQPoint5SatPerByte := bt.NewFeeQuote().
AddQuote(bt.FeeTypeStandard, &bt.Fee{
FeeType: bt.FeeTypeStandard,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
}).AddQuote(bt.FeeTypeData, &bt.Fee{
FeeType: bt.FeeTypeData,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
})

tests := map[string]struct {
tx *bt.Tx
dataLength uint64
Expand Down
90 changes: 0 additions & 90 deletions txinput_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,29 +158,6 @@ func TestTx_FromUTXOs(t *testing.T) {
}

func TestTx_Fund(t *testing.T) {
FQPoint5SatPerByte := bt.NewFeeQuote().
AddQuote(bt.FeeTypeStandard, &bt.Fee{
FeeType: bt.FeeTypeStandard,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
}).AddQuote(bt.FeeTypeData, &bt.Fee{
FeeType: bt.FeeTypeData,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
})

t.Parallel()
tests := map[string]struct {
tx *bt.Tx
Expand Down Expand Up @@ -467,28 +444,6 @@ func TestTx_Fund(t *testing.T) {
}

func TestTx_Fund_Deficit(t *testing.T) {
FQPoint5SatPerByte := bt.NewFeeQuote().
AddQuote(bt.FeeTypeStandard, &bt.Fee{
FeeType: bt.FeeTypeStandard,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
}).AddQuote(bt.FeeTypeData, &bt.Fee{
FeeType: bt.FeeTypeData,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
})
t.Parallel()
tests := map[string]struct {
utxos []*bt.UTXO
Expand Down Expand Up @@ -700,29 +655,6 @@ func TestTx_FillInput(t *testing.T) {
"76a914af2590a45ae401651fdbdf59a76ad43d1862534088ac",
4000000,
))

FQPoint5SatPerByte := bt.NewFeeQuote().
AddQuote(bt.FeeTypeStandard, &bt.Fee{
FeeType: bt.FeeTypeStandard,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
}).AddQuote(bt.FeeTypeData, &bt.Fee{
FeeType: bt.FeeTypeData,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
})
assert.NoError(t, tx.ChangeToAddress("mwV3YgnowbJJB3LcyCuqiKpdivvNNFiK7M", FQPoint5SatPerByte))

err := tx.FillInput(context.Background(), test.unlocker, bt.UnlockerParams{
Expand Down Expand Up @@ -754,28 +686,6 @@ func TestTx_FillAllInputs(t *testing.T) {
4000000)
assert.NoError(t, err)

FQPoint5SatPerByte := bt.NewFeeQuote().
AddQuote(bt.FeeTypeStandard, &bt.Fee{
FeeType: bt.FeeTypeStandard,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
}).AddQuote(bt.FeeTypeData, &bt.Fee{
FeeType: bt.FeeTypeData,
MiningFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
RelayFee: bt.FeeUnit{
Satoshis: 5,
Bytes: 10,
},
})
err = tx.ChangeToAddress("mwV3YgnowbJJB3LcyCuqiKpdivvNNFiK7M", FQPoint5SatPerByte)
assert.NoError(t, err)

Expand Down

0 comments on commit da68c79

Please sign in to comment.