From 6a1bc5417bf155a94fd7c107c393a6303fca5c12 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Thu, 26 Sep 2024 15:25:48 +0530 Subject: [PATCH] Adding very basic confirmation page --- .../confirmations/Confirm/Confirm.test.tsx | 42 ++----------------- .../confirmations/utils/test/data/helpers.ts | 0 app/util/test/confirm-data-helpers.ts | 35 ++++++++++++++++ 3 files changed, 39 insertions(+), 38 deletions(-) delete mode 100644 app/components/Views/confirmations/utils/test/data/helpers.ts create mode 100644 app/util/test/confirm-data-helpers.ts diff --git a/app/components/Views/confirmations/Confirm/Confirm.test.tsx b/app/components/Views/confirmations/Confirm/Confirm.test.tsx index b24b86c2a0c..af02b70c2fa 100644 --- a/app/components/Views/confirmations/Confirm/Confirm.test.tsx +++ b/app/components/Views/confirmations/Confirm/Confirm.test.tsx @@ -1,48 +1,14 @@ import React from 'react'; import renderWithProvider from '../../../../util/test/renderWithProvider'; -import { backgroundState } from '../../../../util/test/initial-root-state'; +import { personalSignatureConfirmationState } from '../../../../util/test/confirm-data-helpers'; import Confirm from './index'; -process.env.REDESIGNED_SIGNATURE_REQUEST = 'true'; - -const initialState = { - engine: { - backgroundState: { - ...backgroundState, - ApprovalController: { - pendingApprovals: { - '76b33b40-7b5c-11ef-bc0a-25bce29dbc09': { - id: '76b33b40-7b5c-11ef-bc0a-25bce29dbc09', - origin: 'metamask.github.io', - type: 'personal_sign', - time: 1727282253048, - requestData: { - data: '0x4578616d706c652060706572736f6e616c5f7369676e60206d657373616765', - from: '0x935e73edb9ff52e23bac7f7e043a1ecd06d05477', - meta: { - url: 'https://metamask.github.io/test-dapp/', - title: 'E2E Test Dapp', - icon: { uri: 'https://metamask.github.io/metamask-fox.svg' }, - analytics: { request_source: 'In-App-Browser' }, - }, - origin: 'metamask.github.io', - metamaskId: '76b33b40-7b5c-11ef-bc0a-25bce29dbc09', - }, - requestState: null, - expectsResult: true, - }, - }, - pendingApprovalCount: 1, - approvalFlows: [], - }, - }, - }, -}; - describe('Confirm', () => { it('should match snapshot for personal sign', async () => { - const container = renderWithProvider(, { state: initialState }); + const container = renderWithProvider(, { + state: personalSignatureConfirmationState, + }); expect(container).toMatchSnapshot(); }); }); diff --git a/app/components/Views/confirmations/utils/test/data/helpers.ts b/app/components/Views/confirmations/utils/test/data/helpers.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/app/util/test/confirm-data-helpers.ts b/app/util/test/confirm-data-helpers.ts new file mode 100644 index 00000000000..dcd7bc7a541 --- /dev/null +++ b/app/util/test/confirm-data-helpers.ts @@ -0,0 +1,35 @@ +import { backgroundState } from './initial-root-state'; + +export const personalSignatureConfirmationState = { + engine: { + backgroundState: { + ...backgroundState, + ApprovalController: { + pendingApprovals: { + '76b33b40-7b5c-11ef-bc0a-25bce29dbc09': { + id: '76b33b40-7b5c-11ef-bc0a-25bce29dbc09', + origin: 'metamask.github.io', + type: 'personal_sign', + time: 1727282253048, + requestData: { + data: '0x4578616d706c652060706572736f6e616c5f7369676e60206d657373616765', + from: '0x935e73edb9ff52e23bac7f7e043a1ecd06d05477', + meta: { + url: 'https://metamask.github.io/test-dapp/', + title: 'E2E Test Dapp', + icon: { uri: 'https://metamask.github.io/metamask-fox.svg' }, + analytics: { request_source: 'In-App-Browser' }, + }, + origin: 'metamask.github.io', + metamaskId: '76b33b40-7b5c-11ef-bc0a-25bce29dbc09', + }, + requestState: null, + expectsResult: true, + }, + }, + pendingApprovalCount: 1, + approvalFlows: [], + }, + }, + }, + } \ No newline at end of file