Skip to content

Commit d8940d0

Browse files
committed
fix: expect error log in test
1 parent d339d06 commit d8940d0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ describe('AssetsContractController', () => {
612612
const { assetsContract, messenger, provider, networkClientConfiguration } =
613613
await setupAssetContractControllers();
614614
assetsContract.configure({ provider });
615+
const errorLogSpy = jest.spyOn(console, 'error').mockImplementationOnce(() => {});
615616
mockNetworkWithDefaultChainId({
616617
networkClientConfiguration,
617618
mocks: [
@@ -653,6 +654,8 @@ describe('AssetsContractController', () => {
653654
'0',
654655
);
655656
expect(uri).toBe('https://api.godsunchained.com/card/0');
657+
expect(errorLogSpy).toHaveBeenCalledTimes(1);
658+
expect(errorLogSpy.mock.calls).toContainEqual(['Contract does not support ERC721 metadata interface.']);
656659

657660
messenger.clearEventSubscriptions('NetworkController:networkDidChange');
658661
});

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,12 +459,15 @@ describe('AssetsContractController with NetworkClientId', () => {
459459
},
460460
],
461461
});
462+
const errorLogSpy = jest.spyOn(console, 'error').mockImplementationOnce(() => {});
462463
const uri = await assetsContract.getERC721TokenURI(
463464
'0x0000000000000000000000000000000000000000',
464465
'0',
465466
'mainnet',
466467
);
467468
expect(uri).toBe('https://api.godsunchained.com/card/0');
469+
expect(errorLogSpy).toHaveBeenCalledTimes(1);
470+
expect(errorLogSpy.mock.calls).toContainEqual(['Contract does not support ERC721 metadata interface.']);
468471
messenger.clearEventSubscriptions('NetworkController:stateChange');
469472
});
470473

0 commit comments

Comments
 (0)