Skip to content

Commit

Permalink
optional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DZariusz committed Jul 24, 2024
1 parent dff882b commit 7bcb8f8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
14 changes: 10 additions & 4 deletions test/factories/BlockchainFactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ import settings from '../../src/config/settings';

describe('BlockchainFactory', () => {
describe('#create', () => {
describe('Given a foreign chainId for an evm blockchain', async () => {
describe('Given a foreign chainId for an evm blockchain (optional)', async () => {
ForeignChainsIds.filter((x) => !NonEvmChainsIds.includes(x)).forEach((chainId) => {
it('should return a Blockchain instance', async () => {
const blockchain = BlockchainFactory.create({ chainId, settings });
expect(!!blockchain).to.eql(true);
expect(blockchain.chainId).to.eql(chainId);
try {
const blockchain = BlockchainFactory.create({chainId, settings});
expect(!!blockchain).to.eql(true);
expect(blockchain.chainId).to.eql(chainId);
} catch (e) {
if (e.message.includes('could not detect network')) {
console.error(e.message);
} throw e;
}
});
});
});
Expand Down
19 changes: 12 additions & 7 deletions test/repositories/ChainContractRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'reflect-metadata';
import { expect } from 'chai';
import { ChainContractRepository } from '../../src/repositories/ChainContractRepository';
import { BlockchainRepository } from '../../src/repositories/BlockchainRepository';
import { ChainsIds, ForeignChainsIds, NonEvmChainsIds } from '../../src/types/ChainsIds';
import { ForeignChainsIds, NonEvmChainsIds } from '../../src/types/ChainsIds';

import { getTestContainer } from '../helpers/getTestContainer';

Expand All @@ -17,16 +17,21 @@ describe('ChainContractRepository', () => {
});

describe('#get', () => {
describe('Given a foreign chainId for an evm blockchain', async () => {
describe('Given a foreign chainId for an evm blockchain (optional)', async () => {
ForeignChainsIds.filter((x) => !NonEvmChainsIds.includes(x))
.filter((x) => x !== ChainsIds.ARBITRUM) // TODO enable when we move to goerli
.forEach((chainId) => {
it(`should return a ForeignChainContract instance for ${chainId}`, async () => {
const foreignChainContract = chainContractRepository.get(chainId);
expect(foreignChainContract).to.not.empty;
try {
const foreignChainContract = chainContractRepository.get(chainId);
expect(foreignChainContract).to.not.empty;

await foreignChainContract.resolveContract();
expect(foreignChainContract.address()).to.not.empty;
await foreignChainContract.resolveContract();
expect(foreignChainContract.address()).to.not.empty;
} catch (e) {
if (e.message.includes('could not detect network')) {
console.error(e.message);
} throw e;
}
});
});
});
Expand Down

0 comments on commit 7bcb8f8

Please sign in to comment.