Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collectibles updates #454

Merged
merged 18 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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