Skip to content

Commit

Permalink
fix: expect error log in test
Browse files Browse the repository at this point in the history
  • Loading branch information
sahar-fehri committed Apr 11, 2024
1 parent d339d06 commit 62ebcfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ describe('AssetsContractController', () => {
const { assetsContract, messenger, provider, networkClientConfiguration } =
await setupAssetContractControllers();
assetsContract.configure({ provider });
const errorLogSpy = jest.spyOn(console, 'error').mockImplementationOnce(() => {}); // jest.spyOn(console, 'log').mockImplementation(() => {});

Check failure on line 615 in packages/assets-controllers/src/AssetsContractController.test.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

Replace `.spyOn(console,·'error')` with `⏎······.spyOn(console,·'error')⏎······`

Check failure on line 615 in packages/assets-controllers/src/AssetsContractController.test.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

Unexpected empty arrow function
mockNetworkWithDefaultChainId({
networkClientConfiguration,
mocks: [
Expand Down Expand Up @@ -653,6 +654,10 @@ describe('AssetsContractController', () => {
'0',
);
expect(uri).toBe('https://api.godsunchained.com/card/0');
expect(errorLogSpy).toHaveBeenCalledTimes(1);

console.log('heeere', errorLogSpy.mock.calls)

Check failure on line 659 in packages/assets-controllers/src/AssetsContractController.test.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

Insert `;`
expect(errorLogSpy.mock.calls).toContainEqual(['Contract does not support ERC721 metadata interface.']);

Check failure on line 660 in packages/assets-controllers/src/AssetsContractController.test.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

Replace `'Contract·does·not·support·ERC721·metadata·interface.'` with `⏎······'Contract·does·not·support·ERC721·metadata·interface.',⏎····`

messenger.clearEventSubscriptions('NetworkController:networkDidChange');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,15 @@ describe('AssetsContractController with NetworkClientId', () => {
},
],
});
const errorLogSpy = jest.spyOn(console, 'error').mockImplementationOnce(() => {});

Check failure on line 462 in packages/assets-controllers/src/AssetsContractControllerWithNetworkClientId.test.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

Replace `.spyOn(console,·'error')` with `⏎······.spyOn(console,·'error')⏎······`

Check failure on line 462 in packages/assets-controllers/src/AssetsContractControllerWithNetworkClientId.test.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

Unexpected empty arrow function
const uri = await assetsContract.getERC721TokenURI(
'0x0000000000000000000000000000000000000000',
'0',
'mainnet',
);
expect(uri).toBe('https://api.godsunchained.com/card/0');
expect(errorLogSpy).toHaveBeenCalledTimes(1);
expect(errorLogSpy.mock.calls).toContainEqual(['Contract does not support ERC721 metadata interface.']);

Check failure on line 470 in packages/assets-controllers/src/AssetsContractControllerWithNetworkClientId.test.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

Replace `'Contract·does·not·support·ERC721·metadata·interface.'` with `⏎······'Contract·does·not·support·ERC721·metadata·interface.',⏎····`
messenger.clearEventSubscriptions('NetworkController:stateChange');
});

Expand Down

0 comments on commit 62ebcfd

Please sign in to comment.