Skip to content

Commit

Permalink
fix: clear nock after tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marslavish committed Mar 11, 2024
1 parent 6d38a34 commit cecb348
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 10 additions & 6 deletions packages/client/__tests__/client-mock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@ describe('Test client', () => {
let client: ChainRegistryClient;

beforeAll(async () => {
nockByChainName('osmosis');
client = new ChainRegistryClient({ chainNames: ['osmosis'] });
nockByChainName('stargaze');
client = new ChainRegistryClient({ chainNames: ['stargaze'] });
await client.fetch();
});

afterAll(() => {
nock.restore();
});

it('Test mock fetching chain data', () => {
const chainData = client.getChain('osmosis');
expect(chainData?.chain_name).toEqual('osmosis');
const chainData = client.getChain('stargaze');
expect(chainData?.chain_name).toEqual('stargaze');
});

it('Test mock fetching asset list', () => {
const assetList = client.getChainAssetList('osmosis');
expect(assetList?.assets.length).toEqual(3);
const assetList = client.getChainAssetList('stargaze');
expect(assetList?.assets.length).toEqual(1);
});
});
4 changes: 3 additions & 1 deletion packages/client/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ChainRegistryClient, ChainUtils } from '../src';

const timeout = 30000;

describe('tests for asset-list-util', () => {
let utils: ChainUtils;

Expand All @@ -14,7 +16,7 @@ describe('tests for asset-list-util', () => {
assetList,
ibcAssetList
});
});
}, timeout);

it('getAssetByDenom', () => {
const asset = utils.getAssetByDenom('uosmo');
Expand Down

0 comments on commit cecb348

Please sign in to comment.