-
Notifications
You must be signed in to change notification settings - Fork 139
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
Feature: handle lnurl success action #3362
Open
tiankii
wants to merge
19
commits into
GaloyMoney:main
Choose a base branch
from
tiankii:feat--handle-lnurl-success-action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
788c041
feat(lnurl): implement successAction to display message on send-bitco…
esaugomez31 9f9479f
revert(config): restore default endOfLine setting to 'lf'
esaugomez31 1a77f0f
fix(lnurl): ensure successAction updates persist in confirmation screen
esaugomez31 cba0563
Merge branch 'main' into feat--handle-lnurl-success-action
esaugomez31 9046c4f
chore: improve code structure and optimization
esaugomez31 da0627a
feat: url success action - LUD-09
esaugomez31 e655e1c
revert: restore previous duration for Send Bitcoin Completed screen
esaugomez31 8645fd8
feat: LUD-10 AES implemented using decipherAES
esaugomez31 8633633
test: send bitcoin completed screen
esaugomez31 7c06888
fix(success-action): open link button UI
esaugomez31 a4fe8b0
test(send bitcoin screen): LUD-09 tests (message|url|url + message)
esaugomez31 d6626cb
fix: graphql lnInvoicePaymentSend transaction object added
esaugomez31 ad8a973
fix(tsc): preimage validated to SettlementViaLn type
esaugomez31 6b7c942
chore: code refatoring in the send bitcoin completed and send bitcoin…
esaugomez31 728fecd
test: LUD-10 (AES) to send bitcoin completed screen
esaugomez31 a10bb25
feat: description support added to LUD-10 AES
esaugomez31 7dee4af
feat(send-bitcoin-completed): disable auto-redirect after successful …
esaugomez31 ff70e8d
test: send bitcoin confirmation screen test
esaugomez31 d1600df
chore: updating language labels to send bitcoin completed screen and …
esaugomez31 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
__tests__/screens/send-bitcoin-completed-screen.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import React from "react" | ||
import { fireEvent, render, screen, waitFor } from "@testing-library/react-native" | ||
import { loadLocale } from "@app/i18n/i18n-util.sync" | ||
import { i18nObject } from "@app/i18n/i18n-util" | ||
import { | ||
Success, | ||
Queued, | ||
Pending, | ||
SuccessLUD09Message, | ||
SuccessLUD09URL, | ||
SuccessLUD09URLWithDesc, | ||
} from "../../app/screens/send-bitcoin-screen/send-bitcoin-completed-screen.stories" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please use |
||
import { ContextForScreen } from "./helper" | ||
import { Linking } from "react-native" | ||
|
||
jest.mock("react-native-in-app-review", () => ({ | ||
isAvailable: () => true, | ||
RequestInAppReview: jest.fn(), | ||
})) | ||
|
||
describe("SendBitcoinCompletedScreen", () => { | ||
let LL: ReturnType<typeof i18nObject> | ||
|
||
beforeEach(() => { | ||
loadLocale("en") | ||
LL = i18nObject("en") | ||
}) | ||
|
||
it("renders the Success state correctly", async () => { | ||
render( | ||
<ContextForScreen> | ||
<Success /> | ||
</ContextForScreen>, | ||
) | ||
|
||
const successTextElement = await waitFor(() => screen.findByTestId("Success Text")) | ||
expect(successTextElement.props.children).toContain( | ||
"Payment has been sent successfully", | ||
) | ||
}) | ||
|
||
it("renders the Queued state correctly", async () => { | ||
render( | ||
<ContextForScreen> | ||
<Queued /> | ||
</ContextForScreen>, | ||
) | ||
|
||
const queuedTextElement = await waitFor(() => screen.findByTestId("Success Text")) | ||
expect(queuedTextElement.props.children).toEqual( | ||
expect.stringContaining("Your transaction is queued"), | ||
) | ||
}) | ||
|
||
it("renders the Pending state correctly", async () => { | ||
render( | ||
<ContextForScreen> | ||
<Pending /> | ||
</ContextForScreen>, | ||
) | ||
|
||
const pendingTextElement = await waitFor(() => screen.findByTestId("Success Text")) | ||
expect(pendingTextElement.props.children).toEqual( | ||
expect.stringContaining("The payment has been sent"), | ||
) | ||
}) | ||
|
||
it("render successAction - LUD 09 - message", async () => { | ||
const message = "Thanks for your support." | ||
|
||
render( | ||
<ContextForScreen> | ||
<SuccessLUD09Message /> | ||
</ContextForScreen>, | ||
) | ||
|
||
expect(screen.getByText(message)).toBeTruthy() | ||
expect(screen.getByText(LL.SendBitcoinScreen.note())).toBeTruthy() | ||
}) | ||
|
||
it("render successAction - LUD 09 - URL", async () => { | ||
const url = "https://es.blink.sv" | ||
|
||
render( | ||
<ContextForScreen> | ||
<SuccessLUD09URL /> | ||
</ContextForScreen>, | ||
) | ||
|
||
const button = screen.getByText(LL.ScanningQRCodeScreen.openLinkTitle()) | ||
|
||
expect(button).toBeTruthy() | ||
|
||
fireEvent.press(button) | ||
|
||
expect(Linking.openURL).toHaveBeenCalledWith(url) | ||
}) | ||
|
||
it("render successAction - LUD 09 - URL with description", async () => { | ||
const url = "https://es.blink.sv" | ||
const description = "Example URL + description" | ||
|
||
render( | ||
<ContextForScreen> | ||
<SuccessLUD09URLWithDesc /> | ||
</ContextForScreen>, | ||
) | ||
|
||
expect(screen.getByText(description)).toBeTruthy() | ||
|
||
const button = screen.getByText(LL.ScanningQRCodeScreen.openLinkTitle()) | ||
|
||
expect(button).toBeTruthy() | ||
|
||
fireEvent.press(button) | ||
|
||
expect(Linking.openURL).toHaveBeenCalledWith(url) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are missing aes test... you can use this data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!