Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit d1bdca2

Browse files
committed
Display wait spinner when waiting for lightning payment to confirm
1 parent f995f59 commit d1bdca2

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/action/payment.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ class PaymentAction {
105105
});
106106
stream.on('error', reject);
107107
stream.write(JSON.stringify({ payment_request: invoice }), 'utf8');
108+
this._nav.goWait();
108109
});
109110
this._nav.goPayLightningDone();
110111
} catch (err) {
112+
this._nav.goPayLightningConfirm();
111113
this._notification.display({ msg: 'Lightning payment failed!', err });
112114
}
113115
await this._transaction.update();

test/unit/action/payment.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ describe('Action Payments Unit Tests', () => {
203203
JSON.stringify({ payment_request: 'some-invoice' }),
204204
'utf8'
205205
);
206+
expect(nav.goWait, 'was called once');
206207
expect(nav.goPayLightningDone, 'was called once');
207208
expect(notification.display, 'was not called');
208209
expect(transaction.update, 'was called once');
@@ -211,6 +212,7 @@ describe('Action Payments Unit Tests', () => {
211212
it('should display notification on error', async () => {
212213
paymentsOnStub.withArgs('data').yields({ payment_error: 'Boom!' });
213214
await payment.payLightning({ invoice: 'some-payment' });
215+
expect(nav.goPayLightningConfirm, 'was called once');
214216
expect(notification.display, 'was called once');
215217
expect(transaction.update, 'was called once');
216218
});

0 commit comments

Comments
 (0)