diff --git a/src/components/designer/lightning/actions/PayInvoiceModal.spec.tsx b/src/components/designer/lightning/actions/PayInvoiceModal.spec.tsx index 3ff342efc..da68bc9c0 100644 --- a/src/components/designer/lightning/actions/PayInvoiceModal.spec.tsx +++ b/src/components/designer/lightning/actions/PayInvoiceModal.spec.tsx @@ -106,8 +106,8 @@ describe('PayInvoiceModal', () => { }); }); - it('should pay invoice successfully', async () => { - const { getByText, getByLabelText, store } = await renderComponent(); + it('should pay invoice successfully and show correctly formatted success message', async () => { + const { getByText, getByLabelText, store, findByText } = await renderComponent(); fireEvent.change(getByLabelText('BOLT 11 Invoice'), { target: { value: 'lnbc1' } }); fireEvent.click(getByText('Pay Invoice')); await waitFor(() => { @@ -119,6 +119,8 @@ describe('PayInvoiceModal', () => { 'lnbc1', undefined, ); + const element = await findByText('Sent 1,000 sats from alice'); + expect(element).toBeInTheDocument(); }); it('should display an error when paying the invoice fails', async () => { diff --git a/src/components/designer/lightning/actions/PayInvoiceModal.tsx b/src/components/designer/lightning/actions/PayInvoiceModal.tsx index 63c557148..3f76a7a11 100644 --- a/src/components/designer/lightning/actions/PayInvoiceModal.tsx +++ b/src/components/designer/lightning/actions/PayInvoiceModal.tsx @@ -85,7 +85,7 @@ const PayInvoiceModal: React.FC = ({ network }) => { const nodeName = node.name; notify({ message: l('successTitle'), - description: l('successDesc', { amount: format(amount), nodeName, assetName }), + description: l('successDesc', { amount, nodeName, assetName }), }); await hidePayInvoice(); } catch (error: any) { diff --git a/src/lib/tap/tapd/tapdService.spec.ts b/src/lib/tap/tapd/tapdService.spec.ts index daf72ab65..722b53dba 100644 --- a/src/lib/tap/tapd/tapdService.spec.ts +++ b/src/lib/tap/tapd/tapdService.spec.ts @@ -235,7 +235,7 @@ describe('TapdService', () => { }, paymentResult: { paymentPreimage: Buffer.from('preimage'), - valueMsat: 100_000_000, + valueMsat: 1_000_000, }, }; tapdProxyClient.sendPayment = jest.fn().mockResolvedValue(res); diff --git a/src/lib/tap/tapd/tapdService.ts b/src/lib/tap/tapd/tapdService.ts index e2ee18764..0de6424f9 100644 --- a/src/lib/tap/tapd/tapdService.ts +++ b/src/lib/tap/tapd/tapdService.ts @@ -186,7 +186,7 @@ class TapdService implements TapService { const pmt = res.paymentResult as LND.Payment; return { // convert from msat to asset units using the default oracle exchange rate - amount: parseInt(pmt.valueMsat) / 100_000, + amount: parseInt(pmt.valueMsat) / 1000, preimage: pmt.paymentPreimage.toString(), destination: '', };