Skip to content

Commit

Permalink
type root state at sentry util level
Browse files Browse the repository at this point in the history
  • Loading branch information
tommasini committed Jul 12, 2024
1 parent 894d6c3 commit b7a7483
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
26 changes: 12 additions & 14 deletions app/util/sentry/__snapshots__/utils.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ exports[`captureSentryFeedback maskObject masks initial root state fixture 1`] =
"CurrencyRateController": {
"currencyRates": {
"ETH": {
"conversionDate": "1720196397.083",
"conversionRate": "2985.14",
"usdConversionRate": "2985.14",
"conversionDate": 1720196397083,
"conversionRate": 298514,
"usdConversionRate": 298514,
},
},
"currentCurrency": "usd",
Expand All @@ -60,10 +60,10 @@ exports[`captureSentryFeedback maskObject masks initial root state fixture 1`] =
"gasEstimateType": "none",
"gasFeeEstimates": {},
"gasFeeEstimatesByChainId": {},
"nonRPCGasFeeApisDisabled": "number",
"nonRPCGasFeeApisDisabled": "boolean",
},
"KeyringController": {
"isUnlocked": 1,
"isUnlocked": true,
"keyrings": "object",
"vault": "string",
},
Expand All @@ -75,7 +75,7 @@ exports[`captureSentryFeedback maskObject masks initial root state fixture 1`] =
"networksMetadata": {
"mainnet": {
"EIPS": {
"1559": 1,
"1559": true,
},
"status": "available",
},
Expand All @@ -93,21 +93,19 @@ exports[`captureSentryFeedback maskObject masks initial root state fixture 1`] =
"ignoredNfts": "object",
},
"NftDetectionController": "object",
"PermissionController": {
"subjects": "object",
},
"PermissionController": {},
"PreferencesController": {
"disabledRpcMethodPreferences": {
"eth_sign": 0,
"eth_sign": false,
},
"displayNftMedia": 1,
"displayNftMedia": true,
"featureFlags": {},
"identities": "object",
"ipfsGateway": "string",
"isIpfsGatewayEnabled": 1,
"isMultiAccountBalancesEnabled": "number",
"isIpfsGatewayEnabled": true,
"isMultiAccountBalancesEnabled": "boolean",
"lostIdentities": "object",
"securityAlertsEnabled": "number",
"securityAlertsEnabled": "boolean",
"selectedAddress": "string",
"showIncomingTransactions": "object",
"showTestNetworks": "boolean",
Expand Down
35 changes: 18 additions & 17 deletions app/util/sentry/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import {
sentryStateMask,
AllProperties,
} from './utils';
import { DeepPartial } from '../test/renderWithProvider';
import { RootState } from '../../reducers';
import { NetworkStatus } from '@metamask/network-controller';

jest.mock('@sentry/react-native', () => ({
...jest.requireActual('@sentry/react-native'),
Expand Down Expand Up @@ -131,7 +134,7 @@ describe('captureSentryFeedback', () => {
});

describe('maskObject', () => {
const rootState = {
const rootState: DeepPartial<RootState> = {
legalNotices: {
newPrivacyPolicyToastClickedOrClosed: true,
newPrivacyPolicyToastShownDate: null,
Expand Down Expand Up @@ -194,9 +197,9 @@ describe('captureSentryFeedback', () => {
CurrencyRateController: {
currencyRates: {
ETH: {
conversionDate: '1720196397.083',
conversionRate: '2985.14',
usdConversionRate: '2985.14',
conversionDate: 1720196397083,
conversionRate: 298514,
usdConversionRate: 298514,
},
},
currentCurrency: 'usd',
Expand All @@ -206,10 +209,10 @@ describe('captureSentryFeedback', () => {
gasEstimateType: 'none',
gasFeeEstimates: {},
gasFeeEstimatesByChainId: {},
nonRPCGasFeeApisDisabled: 0,
nonRPCGasFeeApisDisabled: false,
},
KeyringController: {
isUnlocked: 1,
isUnlocked: true,
keyrings: [
{
accounts: ['0x6312c98831d74754f86dd4936668a13b7e9ba411'],
Expand All @@ -226,9 +229,9 @@ describe('captureSentryFeedback', () => {
networksMetadata: {
mainnet: {
EIPS: {
1559: 1,
1559: true,
},
status: 'available',
status: NetworkStatus.Available,
},
},
providerConfig: {
Expand All @@ -244,14 +247,12 @@ describe('captureSentryFeedback', () => {
ignoredNfts: [],
},
NftDetectionController: {},
PermissionController: {
subjects: {},
},
PermissionController: undefined,
PreferencesController: {
disabledRpcMethodPreferences: {
eth_sign: 0,
eth_sign: false,
},
displayNftMedia: 1,
displayNftMedia: true,
featureFlags: {},
identities: {
'0x6312c98831D74754F86dd4936668A13B7e9bA411': {
Expand All @@ -261,10 +262,10 @@ describe('captureSentryFeedback', () => {
},
},
ipfsGateway: 'https://cloudflare-ipfs.com/ipfs/',
isIpfsGatewayEnabled: 1,
isMultiAccountBalancesEnabled: 1,
isIpfsGatewayEnabled: true,
isMultiAccountBalancesEnabled: true,
lostIdentities: {},
securityAlertsEnabled: 1,
securityAlertsEnabled: true,
selectedAddress: '0x6312c98831D74754F86dd4936668A13B7e9bA411',
showIncomingTransactions: {
'0x1': true,
Expand Down Expand Up @@ -596,7 +597,7 @@ describe('captureSentryFeedback', () => {
});
});

it.only('handle root state with value null and mask false', () => {
it('handle root state with value null and mask false', () => {
const submask = {
SnapsController: {
[AllProperties]: false,
Expand Down

0 comments on commit b7a7483

Please sign in to comment.