Skip to content

Commit

Permalink
Update test data to be more representative
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing committed Jul 11, 2023
1 parent 025cce9 commit 9c6b9cc
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
13 changes: 11 additions & 2 deletions test/data/mock-state.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,22 @@
"type": "rpc",
"chainId": "0x5",
"ticker": "ETH",
"id": "testNetworkConfigurationId"
"id": "chain5"
},
"networkConfigurations": {
"testNetworkConfigurationId": {
"rpcUrl": "https://testrpc.com",
"chainId": "0x1",
"nickname": "Custom Mainnet RPC"
"nickname": "Custom Mainnet RPC",
"type": "rpc",
"id": "testNetworkConfigurationId"
},
"chain5": {
"type": "rpc",
"chainId": "0x5",
"ticker": "ETH",
"nickname": "Chain 5",
"id": "chain5"
}
},
"keyrings": [
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/fixture-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ function defaultFixture() {
rpcUrl: 'http://localhost:8545',
ticker: 'ETH',
type: 'rpc',
id: 'networkConfigurationId',
},
networkConfigurations: {
networkConfigurationId: {
Expand Down Expand Up @@ -346,6 +347,7 @@ function onboardingFixture() {
rpcUrl: 'http://localhost:8545',
chainId: CHAIN_IDS.LOCALHOST,
nickname: 'Localhost 8545',
id: 'networkConfigurationId',
},
networkConfigurations: {
networkConfigurationId: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ exports[`NFT Details should match minimal props and state snapshot 1`] = `
class="box mm-text mm-avatar-base mm-avatar-base--size-sm mm-avatar-network nft-item__network-badge mm-text--body-sm mm-text--text-transform-uppercase box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-text-default box--background-color-background-alternative box--rounded-full box--border-color-background-default box--border-width-2 box--border-style-solid"
data-testid="nft-network-badge"
>
G
C
</div>
</div>
</div>
Expand Down
18 changes: 16 additions & 2 deletions ui/components/app/nft-details/nft-details.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import {
removeAndIgnoreNft,
setRemoveNftMessage,
} from '../../../store/actions';
import {
CHAIN_IDS,
CURRENCY_SYMBOLS,
MAINNET_DISPLAY_NAME,
NETWORK_TYPES,
} from '../../../../shared/constants/network';
import NftDetails from './nft-details';

jest.mock('copy-to-clipboard');
Expand Down Expand Up @@ -172,7 +178,10 @@ describe('NFT Details', () => {
metamask: {
...mockState.metamask,
providerConfig: {
chainId: '0x1',
chainId: CHAIN_IDS.MAINNET,
type: NETWORK_TYPES.MAINNET,
ticker: CURRENCY_SYMBOLS.ETH,
nickname: MAINNET_DISPLAY_NAME,
},
},
};
Expand Down Expand Up @@ -203,12 +212,16 @@ describe('NFT Details', () => {
...mockState.metamask,
providerConfig: {
chainId: '0x89',
type: 'rpc',
id: 'custom-mainnet',
},
networkConfigurations: {
testNetworkConfigurationId: {
rpcUrl: 'https://testrpc.com',
chainId: '0x89',
nickname: 'Custom Mainnet RPC',
type: 'rpc',
id: 'custom-mainnet',
},
},
},
Expand Down Expand Up @@ -239,7 +252,8 @@ describe('NFT Details', () => {
metamask: {
...mockState.metamask,
providerConfig: {
chainId: '0xaa36a7',
chainId: CHAIN_IDS.SEPOLIA,
type: NETWORK_TYPES.SEPOLIA,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ exports[`App Header should match snapshot 1`] = `
<div
class="box mm-text mm-avatar-base mm-avatar-base--size-xs mm-avatar-network mm-picker-network__avatar-network mm-text--body-xs mm-text--text-transform-uppercase box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-text-default box--background-color-background-alternative box--rounded-full box--border-color-transparent box--border-style-solid box--border-width-1"
>
G
C
</div>
<p
class="box mm-text mm-text--body-sm mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
Goerli
Chain 5
</p>
<span
class="box mm-picker-network__arrow-down-icon mm-icon mm-icon--size-xs box--display-inline-block box--flex-direction-row box--color-icon-default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ const render = (showTestNetworks = false) => {
const store = configureStore({
metamask: {
...mockState.metamask,
providerConfig: {
...mockState.metamask,
// Ensure this chainId matches providerConfig
chainId: '0x1',
},
preferences: {
showTestNetworks,
},
Expand Down

0 comments on commit 9c6b9cc

Please sign in to comment.