Skip to content

Commit

Permalink
fixup! chore(inter-cli): networkConfig handling with explicit access
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Jul 12, 2023
1 parent fe02449 commit 5b7f3d7
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/inter-cli/test/test-networkConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import '@endo/init';

import test from 'ava';
import { getNetworkConfig } from '../src/lib/networkConfig.js';

test('support AGORIC_NET', async t => {
const env = { AGORIC_NET: 'devnet' };
const config = {
chainName: 'agoricdev-20',
gci: 'https://devnet.rpc.agoric.net:443/genesis',
peers: ['fb86a0993c694c981a28fa1ebd1fd692f345348b@34.30.39.238:26656'],
rpcAddrs: ['https://devnet.rpc.agoric.net:443'],
apiAddrs: ['https://devnet.api.agoric.net:443'],
seeds: ['0f04c4610b7511a64b8644944b907416db568590@104.154.56.194:26656'],
};
const fetched = [];
/** @type {typeof window.fetch} */
// @ts-expect-error mock
const fetch = async url => {
fetched.push(url);
return {
json: async () => config,
};
};
const actual = await getNetworkConfig(env, { fetch });
t.deepEqual(actual, config);
t.deepEqual(fetched, ['https://devnet.agoric.net/network-config']);
});

0 comments on commit 5b7f3d7

Please sign in to comment.