tests: added testing for correct thrid-party URLs

This commit is contained in:
Richard Moore 2024-01-17 00:01:29 -05:00
parent e66ce74835
commit fed28e4a8c

View File

@ -5,6 +5,8 @@ import {
} from "./create-provider.js";
import { retryIt } from "./utils.js";
import { JsonRpcProvider, Network } from "../index.js";
import type { Provider } from "../index.js";
@ -225,3 +227,31 @@ describe("Test Provider Transaction operations", function() {
};
});
});
describe("Test Networks", function() {
const networks = [
"arbitrum", "arbitrum-goerli", "arbitrum-sepolia",
"base", "base-goerli", "base-sepolia",
"bnb", "bnbt",
"linea", "linea-goerli",
"matic", "matic-mumbai",
"optimism", "optimism-goerli", "optimism-sepolia",
];
const providerNames = [
"AlchemyProvider", "InfuraProvider", "AnkrProvider"
];
for (const networkName of networks) {
for (const providerName of providerNames) {
const network = Network.from(networkName);
const provider = getProvider(providerName, networkName);
if (provider == null || !(provider instanceof JsonRpcProvider)) { continue; }
it(`checks network chainId: ${ providerName }/${ networkName }`, async function() {
const chainId = await provider.send("eth_chainId", [ ]);
assert.equal(parseInt(chainId), network.chainId, "chainId");
});
}
}
});