From 35363889e9d7d1e1eb080b092140eebca936976a Mon Sep 17 00:00:00 2001 From: abhishandy Date: Thu, 26 Oct 2023 09:12:28 -0400 Subject: [PATCH] test: send form component --- .../Forms/__snapshots__/send.test.js.snap | 255 ++++++++++++++++-- components/atoms/Stepper/Forms/send.test.js | 29 ++ 2 files changed, 265 insertions(+), 19 deletions(-) diff --git a/components/atoms/Stepper/Forms/__snapshots__/send.test.js.snap b/components/atoms/Stepper/Forms/__snapshots__/send.test.js.snap index 4aa42d86..7456fdb0 100644 --- a/components/atoms/Stepper/Forms/__snapshots__/send.test.js.snap +++ b/components/atoms/Stepper/Forms/__snapshots__/send.test.js.snap @@ -3,28 +3,245 @@ exports[`Send should render the component 1`] = `
-
+ logo +

+ Pass Sante +

+
+ + Pass Sante ID: +
+ [ +
+ + 0xcda147 + ... + f368eb4 + +
+ ] +
+
+
+
+
+
+ QRCode +
+
+
+
+ Image Description + Image Description +
+

+ + $ 0.00 + + Health Pass WiiQare +
+ From + + + 0xcda147 + ... + f368eb4 + + + To + + + 0xcda147 + ... + f368eb4 + +

+
+
+
+

+ Envoyer le pass santé au bénéficiaire: +

+ +
+
- - - Error Voucher ! - +
+
+ + +
+
+
`; diff --git a/components/atoms/Stepper/Forms/send.test.js b/components/atoms/Stepper/Forms/send.test.js index e23b7068..e2d7f0f1 100644 --- a/components/atoms/Stepper/Forms/send.test.js +++ b/components/atoms/Stepper/Forms/send.test.js @@ -16,6 +16,26 @@ jest.mock('next/router', () => ({ }), })); +jest.mock('../../../../lib/Fetcher', () => { + return { + __esModule: true, + default: jest.fn().mockReturnValue({ + data: [], + isLoading: false, + isError: false, + }), + }; +}); + +jest.mock('next-qrcode', () => { + return { + __esModule: true, + useQRCode: jest.fn().mockReturnValue({ + Canvas: () =>
QRCode
, + }), + }; +}); + describe('Send', () => { let component; beforeEach(() => { @@ -38,4 +58,13 @@ describe('Send', () => { it('should render the component', () => { expect(component).toMatchSnapshot(); }); + + it('should handle button click', () => { + + fetch.mockResponse("{}"); + + const button = screen.getByText('Voir Pass Santé'); + button.click(); + + }); });