Skip to content

Commit 854d1e2

Browse files
committed
feat: add test
1 parent 5fe69a1 commit 854d1e2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/assets-controllers/src/NftController.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,21 @@ describe('NftController', () => {
392392
expect(callActionSpy).toHaveBeenCalledTimes(0);
393393
});
394394

395+
it('should error if the call to isNftOwner fail', async function () {
396+
const { nftController } = setupController();
397+
jest.spyOn(nftController, 'isNftOwner').mockRejectedValue('Random error');
398+
try {
399+
await nftController.watchNft(
400+
ERC721_NFT,
401+
ERC721,
402+
'https://test-dapp.com',
403+
);
404+
} catch (err) {
405+
// eslint-disable-next-line jest/no-conditional-expect
406+
expect(err).toBe('Random error');
407+
}
408+
});
409+
395410
it('should error if the user does not own the suggested ERC1155 NFT', async function () {
396411
const { nftController, messenger } = setupController({
397412
getERC1155BalanceOf: jest.fn().mockImplementation(() => new BN(0)),

0 commit comments

Comments
 (0)