-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(PayInvoiceModal): fix incorrect sats value displayed for paid inv… #1110
base: master
Are you sure you want to change the base?
fix(PayInvoiceModal): fix incorrect sats value displayed for paid inv… #1110
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1110 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 154 154
Lines 5567 5567
Branches 1082 1128 +46
=========================================
Hits 5567 5567 ☔ View full report in Codecov by Sentry. |
46933a7
to
e6a42df
Compare
Hi @AdamuAbba, I suggest adding some tests to validate the fix. |
Hi @AdamuAbba, I ran the changes you made on my end and it did solve the value issue on the notification. |
Alright @kelvinator07 I'll get on it. Thank you. |
@AdamuAbba Thanks for this fix. LGTM 👌 During my testing of this PR, I noticed that there's also a similar issue with the amount in the notification when sending asset payments. Would you mind applying the fix for this here as well? You'll just need to change this one line in tapdService.ts to amount: parseInt(pmt.valueMsat) / 1000, And also, update the unit test in tapdService.spec.ts to valueMsat: 1_000_000, |
e6a42df
to
7a6d332
Compare
Hey @kelvinator07, it's been a while. For the test, would you advise me to tweak the existing test (show belown) or duplicate it into a new unit test? Also, @jamaljsr, I've pushed the requested changes in my last commit, so once this test is tied in, the PR should be ready for review. sorry for the delay. - it('should pay invoice successfully', async () => {
+ it('should pay invoice successfully and show correctly formatted success message', async () => {
- const { getByText, getByLabelText, store } = await renderComponent();
+ const { getByText, getByLabelText, store, findByText } = await renderComponent();
fireEvent.change(getByLabelText('BOLT 11 Invoice'), { target: { value: 'lnbc1' } });
fireEvent.click(getByText('Pay Invoice'));
await waitFor(() => {
expect(store.getState().modals.payInvoice.visible).toBe(false);
});
const node = network.nodes.lightning[0];
expect(lightningServiceMock.payInvoice).toHaveBeenCalledWith(
node,
'lnbc1',
undefined,
);
+ const element = await findByText('Sent 1,000 sats from alice');
+ expect(element).toBeInTheDocument();
}); --- OR --- it('should display correctly formatted amount in paid invoice success notification', async () => {
const { getByText, findByText, getByLabelText, store } = await renderComponent();
fireEvent.change(getByLabelText('BOLT 11 Invoice'), { target: { value: 'lnbc1' } });
fireEvent.click(getByText('Pay Invoice'));
await waitFor(() => {
expect(store.getState().modals.payInvoice.visible).toBe(false);
});
const node = network.nodes.lightning[0];
expect(lightningServiceMock.payInvoice).toHaveBeenCalledWith(
node,
'lnbc1',
undefined,
);
const element = await findByText('Sent 1,000 sats from alice');
expect(element).toBeInTheDocument();
}); |
The first one is better. It will help reduce duplicate code and robustly test the pay invoice. |
7a6d332
to
084ab87
Compare
Hey @jamaljsr, I think this PR is ready for review when you have the time |
tACK. LGTM! |
Closes #1107
Description
This PR fixes a bug where an incorrect sats value is displayed by the notification for paid invoices (PayInvoiceModal)
Steps to Test
Screenshots