Skip to content

Commit 67eb241

Browse files
committed
test: add support for experimental networks in IExecConfig
1 parent 700c026 commit 67eb241

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

test/lib/e2e/IExecConfig.test.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,31 @@ describe('[IExecConfig]', () => {
130130
);
131131
expect(createConfig).toThrow(errors.ConfigurationError);
132132
});
133+
describe.skip('allowExperimentalNetworks', () => {
134+
test('throw with experimental chains when allowExperimentalNetworks is not enabled', () => {
135+
const createConfig = () =>
136+
new IExecConfig({ ethProvider: 'arbitrum-sepolia-testnet' });
137+
expect(createConfig).toThrow(
138+
new Error('Invalid ethProvider: Invalid provider host name or url'),
139+
);
140+
expect(createConfig).toThrow(errors.ConfigurationError);
141+
});
142+
test('allows experimental chains when allowExperimentalNetworks is enabled', async () => {
143+
const config = new IExecConfig(
144+
{ ethProvider: 'arbitrum-sepolia-testnet' },
145+
{ allowExperimentalNetworks: true },
146+
);
147+
const { provider, signer, chainId } =
148+
await config.resolveContractsClient();
149+
expect(signer).toBeUndefined();
150+
expect(provider).toBeDefined();
151+
expect(provider).toBeInstanceOf(JsonRpcProvider);
152+
expect(chainId).toBe('421614');
153+
const network = await provider.getNetwork();
154+
expect(network.chainId).toBe(421614n);
155+
expect(network.name).toBe('arbitrum-sepolia');
156+
});
157+
});
133158
});
134159

135160
describe('read-only ethProvider from network chainId', () => {
@@ -217,6 +242,30 @@ describe('[IExecConfig]', () => {
217242
);
218243
expect(createConfig).toThrow(errors.ConfigurationError);
219244
});
245+
describe.skip('allowExperimentalNetworks', () => {
246+
test('throw with experimental chains when allowExperimentalNetworks is not enabled', () => {
247+
const createConfig = () => new IExecConfig({ ethProvider: 421614 });
248+
expect(createConfig).toThrow(
249+
new Error('Invalid ethProvider: Invalid provider host name or url'),
250+
);
251+
expect(createConfig).toThrow(errors.ConfigurationError);
252+
});
253+
test('allows experimental chains when allowExperimentalNetworks is enabled', async () => {
254+
const config = new IExecConfig(
255+
{ ethProvider: 421614 },
256+
{ allowExperimentalNetworks: true },
257+
);
258+
const { provider, signer, chainId } =
259+
await config.resolveContractsClient();
260+
expect(signer).toBeUndefined();
261+
expect(provider).toBeDefined();
262+
expect(provider).toBeInstanceOf(JsonRpcProvider);
263+
expect(chainId).toBe('421614');
264+
const network = await provider.getNetwork();
265+
expect(network.chainId).toBe(421614n);
266+
expect(network.name).toBe('arbitrum-sepolia');
267+
});
268+
});
220269
});
221270

222271
describe('read-only ethProvider with API keys', () => {

0 commit comments

Comments
 (0)