-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from LN-Zap/test-improvements
refactor tests
- Loading branch information
Showing
14 changed files
with
157 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[submodule "test/bats"] | ||
path = test/bats | ||
url = https://github.com/bats-core/bats-core.git | ||
[submodule "test/test_helper/bats-support"] | ||
path = test/test_helper/bats-support | ||
url = https://github.com/bats-core/bats-support.git | ||
[submodule "test/test_helper/bats-assert"] | ||
path = test/test_helper/bats-assert | ||
url = https://github.com/bats-core/bats-assert.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
# Initialize and update submodules | ||
git submodule update --init --recursive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
generate_offer_eclair() { | ||
local generate_node=$1 | ||
|
||
run $PROJECT_ROOT/bin/eclair-cli $generate_node tipjarshowoffer | ||
echo $output | ||
} | ||
|
||
generate_offer_cln() { | ||
local generate_node=$1 | ||
|
||
run $PROJECT_ROOT/bin/lightning-cli $generate_node offer 1000 "test offer from $generate_node" | ||
echo "$output" | awk -F'"bolt12": "' '{print $2}' | awk -F'"' '{print $1}' | ||
} |
This file was deleted.
Oops, something went wrong.
Submodule bats-assert
added at
e2d855
Submodule bats-support
added at
9bf10e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
_common_setup() { | ||
load 'test_helper/bats-support/load' | ||
load 'test_helper/bats-assert/load' | ||
|
||
# get the containing directory of this file | ||
# use $BATS_TEST_FILENAME instead of ${BASH_SOURCE[0]} or $0, | ||
# as those will point to the bats executable's location or the preprocessed file respectively | ||
PROJECT_ROOT="$( cd "$( dirname "$BATS_TEST_FILENAME" )/.." >/dev/null 2>&1 && pwd )" | ||
|
||
# Ensure environment is setup. | ||
$PROJECT_ROOT/scripts/setup.sh | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bats | ||
|
||
# set -eo pipefail | ||
# set -x | ||
|
||
setup() { | ||
load 'test_helper/common-setup' | ||
_common_setup | ||
|
||
source "$PROJECT_ROOT/test/functions.sh" | ||
} | ||
|
||
@test "Generate bolt12 offer on cln1 and pay from lndk1 (lnd1 -> cln1)" { | ||
run generate_offer_cln 'cln1' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 1000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} | ||
|
||
@test "Generate bolt12 offer on cln2 and pay from lndk1 (lnd1 -> lnd2 -> cln2)" { | ||
run generate_offer_cln 'cln2' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 1000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} | ||
|
||
@test "Generate bolt12 offer on cln3 and pay from lndk2 (lnd2 -> cln2 -> cln3)" { | ||
run generate_offer_cln 'cln3' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk2 pay-offer $output 1000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} | ||
|
||
@test "Generate bolt12 offer on cln3 and pay from lndk1 (lnd1 -> lnd2 -> cln2 -> cln3)" { | ||
run generate_offer_cln 'cln3' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 1000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bats | ||
|
||
# set -eo pipefail | ||
# set -x | ||
|
||
setup() { | ||
load 'test_helper/common-setup' | ||
_common_setup | ||
|
||
source "$PROJECT_ROOT/test/functions.sh" | ||
} | ||
|
||
@test "Generate bolt12 offer on eclair1 and pay from lndk1 (lnd1 -> eclair1)" { | ||
run generate_offer_eclair 'eclair1' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 1000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} | ||
|
||
@test "Generate bolt12 offer on eclair2 and pay from lndk1 (lnd1 -> lnd2 -> eclair2)" { | ||
run generate_offer_eclair 'eclair2' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 1000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} | ||
|
||
@test "Generate bolt12 offer on eclair3 and pay from lndk2 (lnd2 -> eclair2 -> eclair3)" { | ||
run generate_offer_eclair 'eclair3' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 1000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} | ||
|
||
@test "Generate bolt12 offer on eclair3 and pay from lndk1 (lnd1 -> lnd2 -> eclair2 -> eclair2)" { | ||
run generate_offer_eclair 'eclair2' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 1000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} |