Skip to content

Commit

Permalink
tests: added testing for correct thrid-party URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jan 17, 2024
1 parent e66ce74 commit fed28e4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src.ts/_tests/test-providers-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";


Expand Down Expand Up @@ -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");
});
}
}
});

0 comments on commit fed28e4

Please sign in to comment.