-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from mediaopt/feature/36076-apple-pay
Feature/36076 apple pay
- Loading branch information
Showing
9 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import { ApplePay } from "./ApplePay"; | ||
|
||
import { applePayTestParams } from "./constants"; | ||
|
||
test("ApplePay is shown", () => { | ||
render(<ApplePay {...applePayTestParams} />); | ||
expect(screen).toBeDefined(); | ||
}); |
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,26 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import { ApplePayButton } from "./ApplePayButton"; | ||
|
||
import { applePayTestParams } from "./constants"; | ||
|
||
jest.mock("./ApplePayMask", () => ({ | ||
ApplePayMask: () => <div>ApplePayMask</div>, | ||
})); | ||
jest.mock("../../app/usePayment", () => ({ | ||
usePayment: () => { | ||
return { paymentInfo: { id: "123" } }; | ||
}, | ||
})); | ||
jest.mock("../../app/useHandleCreatePayment", () => ({ | ||
useHandleCreatePayment: () => { | ||
return {}; | ||
}, | ||
})); | ||
|
||
test("ApplePayButton is shown", () => { | ||
render(<ApplePayButton {...applePayTestParams} />); | ||
expect(screen).toBeDefined(); | ||
|
||
const applePayMask = screen.getByText("ApplePayMask"); | ||
expect(applePayMask).toBeDefined(); | ||
}); |
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,18 @@ | ||
import { render, screen, waitFor } from "@testing-library/react"; | ||
import { ApplePayMask } from "./ApplePayMask"; | ||
|
||
import { applePayTestParams, DEVICE_ERROR } from "./constants"; | ||
|
||
jest.mock("../../app/loadScript", () => ({ | ||
__esModule: true, | ||
default: () => Promise.resolve(), | ||
})); | ||
|
||
test("ApplePayMask is shown", async () => { | ||
render(<ApplePayMask {...applePayTestParams} />); | ||
await waitFor(() => { | ||
expect(screen).toBeDefined(); | ||
|
||
expect(screen.getByText(DEVICE_ERROR)).toBeDefined(); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { | ||
testParams, | ||
testRequestHeader, | ||
testOptions, | ||
testVaultParams, | ||
} from "../../constants"; | ||
|
||
export const applePayTestParams = { | ||
...testParams, | ||
requestHeader: testRequestHeader, | ||
options: { | ||
...testOptions, | ||
components: "applepay,buttons", | ||
buyerCountry: "US", | ||
}, | ||
...testVaultParams, | ||
applePayDisplayName: "My Store", | ||
}; | ||
export const DEVICE_ERROR = "This device does not support Apple Pay"; |
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