Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
sahar-fehri committed Jan 13, 2025
1 parent a8fc119 commit aab4f6b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/assets-controllers/src/NftController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4486,6 +4486,33 @@ describe('NftController', () => {

expect(spy).toHaveBeenCalledTimes(0);
});
it('should call update Nft metadata when preferences change is triggered and at least ipfsGateway, openSeaEnabled or isIpfsGatewayEnabled change', async () => {

const {
nftController,
mockGetAccount,
triggerPreferencesStateChange,
triggerSelectedAccountChange,
} = setupController({
defaultSelectedAccount: OWNER_ACCOUNT,
});
const spy = jest.spyOn(nftController, 'updateNftMetadata');
const testNetworkClientId = 'mainnet';
mockGetAccount.mockReturnValue(OWNER_ACCOUNT);
await nftController.addNft('0xtest', '3', {
nftMetadata: { name: '', description: '', image: '', standard: '' },
networkClientId: testNetworkClientId,
});

triggerSelectedAccountChange(OWNER_ACCOUNT);
// trigger preference change
triggerPreferencesStateChange({
...getDefaultPreferencesState(),
ipfsGateway: 'https://toto/ipfs/',
});

expect(spy).toHaveBeenCalledTimes(1);
});
it('should update Nft metadata successfully', async () => {
const tokenURI = 'https://api.pudgypenguins.io/lil/4';
const mockGetERC721TokenURI = jest.fn().mockResolvedValue(tokenURI);
Expand Down

0 comments on commit aab4f6b

Please sign in to comment.