Skip to content

Commit

Permalink
test: remove tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dolcalmi committed Nov 15, 2023
1 parent 1a129ae commit a1758f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 63 deletions.
15 changes: 0 additions & 15 deletions core/api/test/bats/helpers/ln.bash
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,6 @@ lnd_cli() {
$@
}

lnd_start() {
started() {
state="$(lnd_cli state | jq -r '.state')"
is_synced="$(lnd_cli getinfo | jq -r '.synced_to_graph')"
[[ "$state" == "SERVER_ACTIVE" && "$is_synced" == "true" ]] || exit 1
}

docker start "${COMPOSE_PROJECT_NAME}-lnd1-1"
retry 10 5 started
}

lnd_stop() {
docker stop -t 0 "${COMPOSE_PROJECT_NAME}-lnd1-1"
}

lnd2_cli() {
docker exec "${COMPOSE_PROJECT_NAME}-lnd2-1" \
lncli \
Expand Down
56 changes: 8 additions & 48 deletions core/api/test/bats/invoices.bats
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@ setup_file() {
exec_graphql "$token_name" 'ln-usd-invoice-create' "$variables"
}

teardown_file() {
stop_trigger
stop_server
stop_ws_server
stop_exporter
}

setup() {
reset_redis
}

@test "invoices: get invoices for account" {
token_name="$ALICE_TOKEN_NAME"

Expand All @@ -77,43 +66,14 @@ setup() {
[[ "$invoice_count" -eq "2" ]] || exit 1
}

@test "invoices: create invoices from alternate node" {
lnd1_pubkey=$(lnd_cli getinfo | jq -r '.identity_pubkey')
lnd2_pubkey=$(lnd2_cli getinfo | jq -r '.identity_pubkey')
btc_amount=1000

token_name="$ALICE_TOKEN_NAME"
btc_wallet_name="$token_name.btc_wallet_id"

# Generate invoice, it should be from lnd1
variables=$(
jq -n \
--arg wallet_id "$(read_value $btc_wallet_name)" \
--arg amount "$btc_amount" \
'{input: {walletId: $wallet_id, amount: $amount}}'
)
exec_graphql "$token_name" 'ln-invoice-create' "$variables"
invoice="$(graphql_output '.data.lnInvoiceCreate.invoice')"

payment_request="$(echo $invoice | jq -r '.paymentRequest')"
[[ "${payment_request}" != "null" ]] || exit 1
payment_hash="$(echo $invoice | jq -r '.paymentHash')"
[[ "${payment_hash}" != "null" ]] || exit 1

destination_node="$(lnd_cli decodepayreq $payment_request | jq -r '.destination')"
[[ "${destination_node}" == "${lnd1_pubkey}" ]] || exit 1

# Generate invoice after lnd1 stop, it should be from lnd2
lnd_stop
exec_graphql "$token_name" 'ln-invoice-create' "$variables"
invoice="$(graphql_output '.data.lnInvoiceCreate.invoice')"
lnd_start

payment_request="$(echo $invoice | jq -r '.paymentRequest')"
[[ "${payment_request}" != "null" ]] || exit 1
payment_hash="$(echo $invoice | jq -r '.paymentHash')"
[[ "${payment_hash}" != "null" ]] || exit 1
teardown_file() {
stop_trigger
stop_server
stop_ws_server
stop_exporter
}

destination_node="$(lnd2_cli decodepayreq $payment_request | jq -r '.destination')"
[[ "${destination_node}" == "${lnd2_pubkey}" ]] || exit 1
setup() {
reset_redis
}

0 comments on commit a1758f1

Please sign in to comment.