Skip to content

Commit

Permalink
feat: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
sahar-fehri committed Mar 14, 2024
1 parent 5fe69a1 commit 854d1e2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/assets-controllers/src/NftController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,21 @@ describe('NftController', () => {
expect(callActionSpy).toHaveBeenCalledTimes(0);
});

it('should error if the call to isNftOwner fail', async function () {
const { nftController } = setupController();
jest.spyOn(nftController, 'isNftOwner').mockRejectedValue('Random error');
try {
await nftController.watchNft(
ERC721_NFT,
ERC721,
'https://test-dapp.com',
);
} catch (err) {
// eslint-disable-next-line jest/no-conditional-expect
expect(err).toBe('Random error');
}
});

it('should error if the user does not own the suggested ERC1155 NFT', async function () {
const { nftController, messenger } = setupController({
getERC1155BalanceOf: jest.fn().mockImplementation(() => new BN(0)),
Expand Down

0 comments on commit 854d1e2

Please sign in to comment.