|
|
|
@ -613,12 +613,10 @@ describe('MetaMetricsController', function () { |
|
|
|
|
it('should return full user traits object on first call', function () { |
|
|
|
|
const metaMetricsController = getMetaMetricsController(); |
|
|
|
|
const traits = metaMetricsController._buildUserTraitsObject({ |
|
|
|
|
frequentRpcListDetail: [ |
|
|
|
|
{ chainId: MAINNET_CHAIN_ID }, |
|
|
|
|
{ chainId: ROPSTEN_CHAIN_ID }, |
|
|
|
|
], |
|
|
|
|
ledgerTransportType: 'web-hid', |
|
|
|
|
identities: [{}, {}], |
|
|
|
|
addressBook: { |
|
|
|
|
[MAINNET_CHAIN_ID]: [{ address: '0x' }], |
|
|
|
|
[ROPSTEN_CHAIN_ID]: [{ address: '0x' }, { address: '0x0' }], |
|
|
|
|
}, |
|
|
|
|
allCollectibles: { |
|
|
|
|
'0xac706cE8A9BF27Afecf080fB298d0ee13cfb978A': { |
|
|
|
|
56: [ |
|
|
|
@ -645,19 +643,25 @@ describe('MetaMetricsController', function () { |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
frequentRpcListDetail: [ |
|
|
|
|
{ chainId: MAINNET_CHAIN_ID }, |
|
|
|
|
{ chainId: ROPSTEN_CHAIN_ID }, |
|
|
|
|
], |
|
|
|
|
identities: [{}, {}], |
|
|
|
|
ledgerTransportType: 'web-hid', |
|
|
|
|
openSeaEnabled: true, |
|
|
|
|
threeBoxSyncingAllowed: false, |
|
|
|
|
addressBook: { |
|
|
|
|
[MAINNET_CHAIN_ID]: [{ address: '0x' }], |
|
|
|
|
[ROPSTEN_CHAIN_ID]: [{ address: '0x' }, { address: '0x0' }], |
|
|
|
|
}, |
|
|
|
|
useCollectibleDetection: false, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
assert.deepEqual(traits, { |
|
|
|
|
[TRAITS.ADDRESS_BOOK_ENTRIES]: 3, |
|
|
|
|
[TRAITS.LEDGER_CONNECTION_TYPE]: 'web-hid', |
|
|
|
|
[TRAITS.NETWORKS_ADDED]: [MAINNET_CHAIN_ID, ROPSTEN_CHAIN_ID], |
|
|
|
|
[TRAITS.NFT_AUTODETECTION_ENABLED]: false, |
|
|
|
|
[TRAITS.NUMBER_OF_ACCOUNTS]: 2, |
|
|
|
|
[TRAITS.NUMBER_OF_NFT_COLLECTIONS]: 3, |
|
|
|
|
[TRAITS.OPENSEA_API_ENABLED]: true, |
|
|
|
|
[TRAITS.THREE_BOX_ENABLED]: false, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
@ -665,67 +669,76 @@ describe('MetaMetricsController', function () { |
|
|
|
|
it('should return only changed traits object on subsequent calls', function () { |
|
|
|
|
const metaMetricsController = getMetaMetricsController(); |
|
|
|
|
metaMetricsController._buildUserTraitsObject({ |
|
|
|
|
addressBook: { |
|
|
|
|
[MAINNET_CHAIN_ID]: [{ address: '0x' }], |
|
|
|
|
[ROPSTEN_CHAIN_ID]: [{ address: '0x' }, { address: '0x0' }], |
|
|
|
|
}, |
|
|
|
|
frequentRpcListDetail: [ |
|
|
|
|
{ chainId: MAINNET_CHAIN_ID }, |
|
|
|
|
{ chainId: ROPSTEN_CHAIN_ID }, |
|
|
|
|
], |
|
|
|
|
ledgerTransportType: 'web-hid', |
|
|
|
|
openSeaEnabled: true, |
|
|
|
|
identities: [{}, {}], |
|
|
|
|
threeBoxSyncingAllowed: false, |
|
|
|
|
addressBook: { |
|
|
|
|
[MAINNET_CHAIN_ID]: [{ address: '0x' }], |
|
|
|
|
[ROPSTEN_CHAIN_ID]: [{ address: '0x' }, { address: '0x0' }], |
|
|
|
|
}, |
|
|
|
|
useCollectibleDetection: false, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const updatedTraits = metaMetricsController._buildUserTraitsObject({ |
|
|
|
|
addressBook: { |
|
|
|
|
[MAINNET_CHAIN_ID]: [{ address: '0x' }, { address: '0x1' }], |
|
|
|
|
[ROPSTEN_CHAIN_ID]: [{ address: '0x' }, { address: '0x0' }], |
|
|
|
|
}, |
|
|
|
|
frequentRpcListDetail: [ |
|
|
|
|
{ chainId: MAINNET_CHAIN_ID }, |
|
|
|
|
{ chainId: ROPSTEN_CHAIN_ID }, |
|
|
|
|
], |
|
|
|
|
ledgerTransportType: 'web-hid', |
|
|
|
|
openSeaEnabled: false, |
|
|
|
|
identities: [{}, {}, {}], |
|
|
|
|
threeBoxSyncingAllowed: false, |
|
|
|
|
addressBook: { |
|
|
|
|
[MAINNET_CHAIN_ID]: [{ address: '0x' }, { address: '0x1' }], |
|
|
|
|
[ROPSTEN_CHAIN_ID]: [{ address: '0x' }, { address: '0x0' }], |
|
|
|
|
}, |
|
|
|
|
useCollectibleDetection: false, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
assert.deepEqual(updatedTraits, { |
|
|
|
|
[TRAITS.ADDRESS_BOOK_ENTRIES]: 4, |
|
|
|
|
[TRAITS.NUMBER_OF_ACCOUNTS]: 3, |
|
|
|
|
[TRAITS.OPENSEA_API_ENABLED]: false, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should return null if no traits changed', function () { |
|
|
|
|
const metaMetricsController = getMetaMetricsController(); |
|
|
|
|
metaMetricsController._buildUserTraitsObject({ |
|
|
|
|
addressBook: { |
|
|
|
|
[MAINNET_CHAIN_ID]: [{ address: '0x' }], |
|
|
|
|
[ROPSTEN_CHAIN_ID]: [{ address: '0x' }, { address: '0x0' }], |
|
|
|
|
}, |
|
|
|
|
frequentRpcListDetail: [ |
|
|
|
|
{ chainId: MAINNET_CHAIN_ID }, |
|
|
|
|
{ chainId: ROPSTEN_CHAIN_ID }, |
|
|
|
|
], |
|
|
|
|
ledgerTransportType: 'web-hid', |
|
|
|
|
openSeaEnabled: true, |
|
|
|
|
identities: [{}, {}], |
|
|
|
|
threeBoxSyncingAllowed: false, |
|
|
|
|
useCollectibleDetection: true, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const updatedTraits = metaMetricsController._buildUserTraitsObject({ |
|
|
|
|
addressBook: { |
|
|
|
|
[MAINNET_CHAIN_ID]: [{ address: '0x' }], |
|
|
|
|
[ROPSTEN_CHAIN_ID]: [{ address: '0x' }, { address: '0x0' }], |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const updatedTraits = metaMetricsController._buildUserTraitsObject({ |
|
|
|
|
frequentRpcListDetail: [ |
|
|
|
|
{ chainId: MAINNET_CHAIN_ID }, |
|
|
|
|
{ chainId: ROPSTEN_CHAIN_ID }, |
|
|
|
|
], |
|
|
|
|
ledgerTransportType: 'web-hid', |
|
|
|
|
openSeaEnabled: true, |
|
|
|
|
identities: [{}, {}], |
|
|
|
|
threeBoxSyncingAllowed: false, |
|
|
|
|
addressBook: { |
|
|
|
|
[MAINNET_CHAIN_ID]: [{ address: '0x' }], |
|
|
|
|
[ROPSTEN_CHAIN_ID]: [{ address: '0x' }, { address: '0x0' }], |
|
|
|
|
}, |
|
|
|
|
useCollectibleDetection: true, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
assert.equal(updatedTraits, null); |
|
|
|
|