Skip to content

Commit

Permalink
Adding very basic confirmation page
Browse files Browse the repository at this point in the history
  • Loading branch information
jpuri committed Sep 26, 2024
1 parent 044db79 commit 6a1bc54
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 38 deletions.
42 changes: 4 additions & 38 deletions app/components/Views/confirmations/Confirm/Confirm.test.tsx
Original file line number Diff line number Diff line change
@@ -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(<Confirm />, { state: initialState });
const container = renderWithProvider(<Confirm />, {
state: personalSignatureConfirmationState,
});
expect(container).toMatchSnapshot();
});
});
Empty file.
35 changes: 35 additions & 0 deletions app/util/test/confirm-data-helpers.ts
Original file line number Diff line number Diff line change
@@ -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: [],
},
},
},
}

0 comments on commit 6a1bc54

Please sign in to comment.