test: fix naming in client tests

pull/497/head
Andras Banki-Horvath 2 years ago
parent 00cf4bf71c
commit 152677fcc7
No known key found for this signature in database
GPG Key ID: 80E5375C094198D8

@ -45,9 +45,9 @@ var (
defaultConfirmations = int32(loopdb.DefaultLoopOutHtlcConfirmations) defaultConfirmations = int32(loopdb.DefaultLoopOutHtlcConfirmations)
) )
// TestSuccess tests the loop out happy flow, using a custom htlc confirmation // TestLoopOutSuccess tests the loop out happy flow, using a custom htlc
// target. // confirmation target.
func TestSuccess(t *testing.T) { func TestLoopOutSuccess(t *testing.T) {
defer test.Guard(t)() defer test.Guard(t)()
ctx := createClientTestContext(t, nil) ctx := createClientTestContext(t, nil)
@ -70,15 +70,15 @@ func TestSuccess(t *testing.T) {
// Expect client to register for conf. // Expect client to register for conf.
confIntent := ctx.AssertRegisterConf(false, req.HtlcConfirmations) confIntent := ctx.AssertRegisterConf(false, req.HtlcConfirmations)
testSuccess(ctx, testRequest.Amount, info.SwapHash, testLoopOutSuccess(ctx, testRequest.Amount, info.SwapHash,
signalPrepaymentResult, signalSwapPaymentResult, false, signalPrepaymentResult, signalSwapPaymentResult, false,
confIntent, swap.HtlcV2, confIntent, swap.HtlcV2,
) )
} }
// TestFailOffchain tests the handling of swap for which the server failed the // TestLoopOutFailOffchain tests the handling of swap for which the server
// payments. // failed the payments.
func TestFailOffchain(t *testing.T) { func TestLoopOutFailOffchain(t *testing.T) {
defer test.Guard(t)() defer test.Guard(t)()
ctx := createClientTestContext(t, nil) ctx := createClientTestContext(t, nil)
@ -110,8 +110,9 @@ func TestFailOffchain(t *testing.T) {
ctx.finish() ctx.finish()
} }
// TestWrongAmount asserts that the client checks the server invoice amounts. // TestLoopOutWrongAmount asserts that the client checks the server invoice
func TestFailWrongAmount(t *testing.T) { // amounts.
func TestLoopOutFailWrongAmount(t *testing.T) {
defer test.Guard(t)() defer test.Guard(t)()
test := func(t *testing.T, modifier func(*serverMock), test := func(t *testing.T, modifier func(*serverMock),
@ -148,9 +149,9 @@ func TestFailWrongAmount(t *testing.T) {
} }
// TestResume tests that swaps in various states are properly resumed after a // TestLoopOutResume tests that swaps in various states are properly resumed
// restart. // after a restart.
func TestResume(t *testing.T) { func TestLoopOutResume(t *testing.T) {
defer test.Guard(t)() defer test.Guard(t)()
defaultConfs := loopdb.DefaultLoopOutHtlcConfirmations defaultConfs := loopdb.DefaultLoopOutHtlcConfirmations
@ -165,26 +166,26 @@ func TestResume(t *testing.T) {
t.Run(version.String(), func(t *testing.T) { t.Run(version.String(), func(t *testing.T) {
t.Run("not expired", func(t *testing.T) { t.Run("not expired", func(t *testing.T) {
testResume( testLoopOutResume(
t, defaultConfs, false, false, true, t, defaultConfs, false, false, true,
version, version,
) )
}) })
t.Run("not expired, custom confirmations", t.Run("not expired, custom confirmations",
func(t *testing.T) { func(t *testing.T) {
testResume( testLoopOutResume(
t, 3, false, false, true, t, 3, false, false, true,
version, version,
) )
}) })
t.Run("expired not revealed", func(t *testing.T) { t.Run("expired not revealed", func(t *testing.T) {
testResume( testLoopOutResume(
t, defaultConfs, true, false, false, t, defaultConfs, true, false, false,
version, version,
) )
}) })
t.Run("expired revealed", func(t *testing.T) { t.Run("expired revealed", func(t *testing.T) {
testResume( testLoopOutResume(
t, defaultConfs, true, true, true, t, defaultConfs, true, true, true,
version, version,
) )
@ -193,7 +194,7 @@ func TestResume(t *testing.T) {
} }
} }
func testResume(t *testing.T, confs uint32, expired, preimageRevealed, func testLoopOutResume(t *testing.T, confs uint32, expired, preimageRevealed,
expectSuccess bool, protocolVersion loopdb.ProtocolVersion) { expectSuccess bool, protocolVersion loopdb.ProtocolVersion) {
defer test.Guard(t)() defer test.Guard(t)()
@ -302,7 +303,7 @@ func testResume(t *testing.T, confs uint32, expired, preimageRevealed,
// Because there is no reliable payment yet, an invoice is assumed to be // Because there is no reliable payment yet, an invoice is assumed to be
// paid after resume. // paid after resume.
testSuccess(ctx, amt, hash, testLoopOutSuccess(ctx, amt, hash,
func(r error) {}, func(r error) {},
func(r error) {}, func(r error) {},
preimageRevealed, preimageRevealed,
@ -310,7 +311,7 @@ func testResume(t *testing.T, confs uint32, expired, preimageRevealed,
) )
} }
func testSuccess(ctx *testContext, amt btcutil.Amount, hash lntypes.Hash, func testLoopOutSuccess(ctx *testContext, amt btcutil.Amount, hash lntypes.Hash,
signalPrepaymentResult, signalSwapPaymentResult func(error), signalPrepaymentResult, signalSwapPaymentResult func(error),
preimageRevealed bool, confIntent *test.ConfRegistration, preimageRevealed bool, confIntent *test.ConfRegistration,
scriptVersion swap.ScriptVersion) { scriptVersion swap.ScriptVersion) {

Loading…
Cancel
Save