1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 13:47:06 +01:00
metamask-extension/ui/pages/confirm-signature-request/index.test.js
Niranjana Binoy 0c203d0518
Signature-Request refactor (#19104)
* refactoring signature-request and adding test coverage

* adding storybook and removing the reduntant files:

* adding new components from

* replacing <SiteOrigin/> with <TagUrl/>

* updating review comments from Jyoti and George

* adding the hook

* refactoring in the changes from #18770 MMI PR

* adding new hook for the MMISign changes

* updating lavamoat

* updating lavamoat

* removing a commeted line

* updating the sign check with accountType conditional

* fixing build issues

* updating the review comments on the hooks

* updating signatureRequestHeader

* lint fix

* fixing test failure

* lint fix

* updating review comments

* adding the renamed hook

* updating the origin url

* fixing test failure

* migrating changes from #19184

* updating snapshot

* fixing e2e failure

* fixing e2e failure

* addressing review comments from Joao

* migrating chnages from #19892

* moving shallowEqual inside of mmi build

* migrating changes from #19881

* fixing build failure

* migrating changes from #19949

* migrating changes from #19468

* updating snapshot

* updating snapshot

* updating QA review comments

* fixing full screen height issue from develop

* migrating changes from #20083

* fixing snapshot
2023-07-20 18:51:38 +01:00

70 lines
2.7 KiB
JavaScript

import React from 'react';
import configureMockStore from 'redux-mock-store';
import { renderWithProvider } from '../../../test/lib/render-helpers';
import ConfTx from '.';
const mockState = {
metamask: {
identities: {
'0x8eeee1781fd885ff5ddef7789486676961873d12': {
address: '0x8eeee1781fd885ff5ddef7789486676961873d12',
lastSelected: 1673587189888,
name: 'Account 1',
},
},
unapprovedMsgs: {},
unapprovedMsgCount: 0,
unapprovedPersonalMsgs: {},
unapprovedPersonalMsgCount: 0,
unapprovedTypedMessages: {
267460284130106: {
id: 267460284130106,
msgParams: {
data: '{"domain":{"chainId":"5","name":"Ether Mail","verifyingContract":"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC","version":"1"},"message":{"contents":"Hello, Bob!","from":{"name":"Cow","wallets":["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826","0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"]},"to":[{"name":"Bob","wallets":["0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57","0xB0B0b0b0b0b0B000000000000000000000000000"]}]},"primaryType":"Mail","types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Group":[{"name":"name","type":"string"},{"name":"members","type":"Person[]"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person[]"},{"name":"contents","type":"string"}],"Person":[{"name":"name","type":"string"},{"name":"wallets","type":"address[]"}]}}',
from: '0x8eeee1781fd885ff5ddef7789486676961873d12',
version: 'V4',
origin: 'https://metamask.github.io',
},
time: 1674533844299,
status: 'unapproved',
type: 'eth_signTypedData',
},
},
unapprovedTypedMessagesCount: 1,
providerConfig: { chainId: '0x5', type: 'goerli' },
keyrings: [],
networkConfigurations: {},
subjectMetadata: {},
cachedBalances: {
'0x5': {},
},
accounts: {
'0x8eeee1781fd885ff5ddef7789486676961873d12': {
address: '0x8eeee1781fd885ff5ddef7789486676961873d12',
balance: '0x7e64033f2fdb0436',
},
},
selectedAddress: '0x8eeee1781fd885ff5ddef7789486676961873d12',
addressBook: {},
tokenList: {},
preferences: {},
},
appState: {
warning: null,
txId: 0,
},
history: { mostRecentOverviewPage: '/' },
send: { draftTransactions: {} },
};
describe('Confirm Signature Request Component', () => {
const store = configureMockStore()(mockState);
describe('render', () => {
it('should match snapshot', () => {
const { container } = renderWithProvider(<ConfTx />, store);
expect(container).toMatchSnapshot();
});
});
});