From 2c0d3214078aeca45191d579e26351b8a88deff1 Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Mon, 25 May 2026 15:59:28 +0700 Subject: [PATCH] fix: repair failing unit tests - Update pay-invoice invocations in the payment and hold-invoice tests to pass the invoice as a positional argument (changed in #31) instead of the removed -i flag - Expect the SDK's "Invalid NWC URL" message in the malformed connection string test (the SDK now validates in the NWCClient constructor) - Use a current faucet lightning address in the request-invoice test (the previous one had expired) Co-Authored-By: Claude Opus 4.7 (1M context) --- src/test/connection-secret.test.ts | 2 +- src/test/lightning-tools.test.ts | 2 +- src/test/nwc-hold-invoices.test.ts | 2 -- src/test/nwc-payments.test.ts | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/test/connection-secret.test.ts b/src/test/connection-secret.test.ts index 23d99c0..bc0d5a3 100644 --- a/src/test/connection-secret.test.ts +++ b/src/test/connection-secret.test.ts @@ -64,7 +64,7 @@ describe("Connection Secret Handling", () => { test("errors when connection string is malformed", () => { const result = runCli<{ error: string }>(`-c "nostr+walletconnect://asdf" get-balance`); expect(result.success).toBe(false); - expect(result.output.error).toContain("Invalid connection secret"); + expect(result.output.error).toContain("Invalid NWC URL"); }); test("reads connection secret from NWC_URL environment variable", () => { diff --git a/src/test/lightning-tools.test.ts b/src/test/lightning-tools.test.ts index a2147af..9e83f32 100644 --- a/src/test/lightning-tools.test.ts +++ b/src/test/lightning-tools.test.ts @@ -10,7 +10,7 @@ import type { MakeInvoiceResult } from "../tools/nwc/make_invoice.js"; const exampleInvoice = "lnbc1u1p5hlrr8dqqnp4qwmtpr4p72ms7gnq3pkfk2876y2msvl33s3840dlp6xsv2w59dpscpp55utq6s8u5407namwt4jvhgsaf9fyszppjfwyxp7qsw6cyc8vxukqsp583usez9yhmkcavvvjz8cq56v3nglh2q37xkf4ufrgwxfrfjkm54s9qyysgqcqzp2xqyz5vqgtyysw64zt9sj6kfpqnekzwc37y2uyg0xdapgxqqth4uahff0x89sjfsvukjlllasg5dn05u2uha6qcvxz2y3ye5k7958qtes4pv4ggqtnjyky"; -const exampleLightningAddress = "nwc1769966844@getalby.com"; +const exampleLightningAddress = "nwc1779699236161@getalby.com"; describe("Lightning Tools (no wallet required)", () => { test("fiat-to-sats converts USD to sats", () => { diff --git a/src/test/nwc-hold-invoices.test.ts b/src/test/nwc-hold-invoices.test.ts index 5f51159..9acc2b4 100644 --- a/src/test/nwc-hold-invoices.test.ts +++ b/src/test/nwc-hold-invoices.test.ts @@ -66,7 +66,6 @@ describe("NWC HOLD Invoice Commands", () => { "-c", sender.nwcUrl, "pay-invoice", - "-i", holdResult.output.invoice, ], { stdio: ["ignore", "pipe", "pipe"] } @@ -104,7 +103,6 @@ describe("NWC HOLD Invoice Commands", () => { "-c", sender.nwcUrl, "pay-invoice", - "-i", holdResult.output.invoice, ], { stdio: ["ignore", "pipe", "pipe"] } diff --git a/src/test/nwc-payments.test.ts b/src/test/nwc-payments.test.ts index 87062d1..393812e 100644 --- a/src/test/nwc-payments.test.ts +++ b/src/test/nwc-payments.test.ts @@ -26,7 +26,7 @@ describe("NWC Payment Commands", () => { // Pay with sender wallet const paymentResult = runCli( - `-c "${sender.nwcUrl}" pay-invoice -i "${invoiceResult.output.invoice}"` + `-c "${sender.nwcUrl}" pay-invoice "${invoiceResult.output.invoice}"` ); expect(paymentResult.success).toBe(true); expect(paymentResult.output.preimage).toBeDefined(); @@ -41,7 +41,7 @@ describe("NWC Payment Commands", () => { // Pay the invoice first (unpaid invoices may not be found) const payResult = runCli( - `-c "${sender.nwcUrl}" pay-invoice -i "${invoiceResult.output.invoice}"` + `-c "${sender.nwcUrl}" pay-invoice "${invoiceResult.output.invoice}"` ); expect(payResult.success).toBe(true);