Skip to content

Commit

Permalink
Collectibles updates (#454)
Browse files Browse the repository at this point in the history
* openseainterface

* openseainterface

* types

* fixes MetaMask/metamask-mobile#2264

* collectiblesmetadata

* collectiblecontract

* compareCollectiblesMetadata

* compareCollectiblesMetadatatest

* ignoreassigns

* lintfix

* Revert "Add BaseControllerV2 support to ComposableController (#447)"

This reverts commit 5777094.

* ApiCollectibleLastSale

* address

* addmetadata

* fixtests

* Revert "Revert "Add BaseControllerV2 support to ComposableController (#447)""

This reverts commit c3ebf47.

* ignore
  • Loading branch information
estebanmino committed May 20, 2021
1 parent abc960e commit b8ba44c
Show file tree
Hide file tree
Showing 6 changed files with 463 additions and 100 deletions.
35 changes: 29 additions & 6 deletions src/assets/AssetsController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,33 @@ describe('AssetsController', () => {
});
});

it('should update collectible if image is different', async () => {
await assetsController.addCollectible('foo', 1, {
name: 'name',
image: 'image',
description: 'description',
});
expect(assetsController.state.collectibles[0]).toStrictEqual({
address: '0xfoO',
description: 'description',
image: 'image',
name: 'name',
tokenId: 1,
});
await assetsController.addCollectible('foo', 1, {
name: 'name',
image: 'image-updated',
description: 'description',
});
expect(assetsController.state.collectibles[0]).toStrictEqual({
address: '0xfoO',
description: 'description',
image: 'image-updated',
name: 'name',
tokenId: 1,
});
});

it('should not duplicate collectible nor collectible contract if already added', async () => {
await assetsController.addCollectible('foo', 1, {
name: 'name',
Expand Down Expand Up @@ -329,7 +356,7 @@ describe('AssetsController', () => {
expect(assetsController.state.collectibles[0]).toStrictEqual({
address: '0xfoO',
description: 'Description',
image: 'url',
imageOriginal: 'url',
name: 'Name',
tokenId: 1,
});
Expand All @@ -346,18 +373,14 @@ describe('AssetsController', () => {
await assetsController.addCollectible(KUDOSADDRESS, 1203);
expect(assetsController.state.collectibles[0]).toStrictEqual({
address: '0x2aEa4Add166EBf38b63d09a75dE1a7b94Aa24163',
description: undefined,
image: 'Kudos Image',
name: 'Kudos Name',
tokenId: 1203,
});
expect(assetsController.state.collectibleContracts[0]).toStrictEqual({
address: '0x2aEa4Add166EBf38b63d09a75dE1a7b94Aa24163',
description: undefined,
logo: undefined,
name: 'KudosToken',
symbol: 'KDO',
totalSupply: undefined,
});
});

Expand Down Expand Up @@ -435,7 +458,7 @@ describe('AssetsController', () => {
{
address: '0x2aEa4Add166EBf38b63d09a75dE1a7b94Aa24163',
description: 'Kudos Description',
image: 'Kudos url',
imageOriginal: 'Kudos url',
name: 'Kudos Name',
tokenId: 1203,
},
Expand Down
Loading

0 comments on commit b8ba44c

Please sign in to comment.