1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/app/scripts/controllers/network
Zachary Belford cd2249f193
Add tests for custom JSON-RPC network client (#16337)
Previously we had written tests for `createInfuraClient`, which creates a middleware stack designed to connect to an Infura provider. These tests exercise various RPC methods that relate to the behavior that the middleware provides (mainly around caching). 

Now we need to write the same tests but for `createJsonRpcClient`, which creates a middleware stack designed to connect to a non-Infura RPC endpoint. To do this, we had to:

- Consolidate the tests for both types of RPC client into a single test file.
- Add conditions around tests or assertions in tests to account for differences in behavior between the two sets of middleware stacks.
- Relocate code in `createJsonRpcClient` which slows down `eth_estimateGas` calls just for tests so that this behavior can be disabled in the network client tests.

Eventually, as we unify the network controllers in this repo and in the core repo, we will move these tests into the core repo.

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
2023-01-06 10:10:17 -07:00
..
middleware @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
provider-api-tests Add tests for custom JSON-RPC network client (#16337) 2023-01-06 10:10:17 -07:00
createInfuraClient.js Update eth-json-rpc-infura (#15845) 2022-09-15 14:41:18 -02:30
createInfuraClient.test.js Add tests for custom JSON-RPC network client (#16337) 2023-01-06 10:10:17 -07:00
createJsonRpcClient.js Add tests for custom JSON-RPC network client (#16337) 2023-01-06 10:10:17 -07:00
createJsonRpcClient.test.js Add tests for custom JSON-RPC network client (#16337) 2023-01-06 10:10:17 -07:00
createMetamaskMiddleware.js eth-json-rpc-middleware@8.0.0 (#10738) 2021-11-11 12:26:49 -08:00
index.js Rename the network controller module (#16974) 2022-12-16 16:37:06 -03:30
network-controller.js Stop block tracker after each network controller unit test (#17032) 2023-01-04 17:46:22 -03:30
network-controller.test.js Stop block tracker after each network controller unit test (#17032) 2023-01-04 17:46:22 -03:30
pending-middleware.test.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
util.js Ensure createPendingTxMiddleware returns gasPrice for EIP-1559 transactions (#11685) 2021-07-30 18:10:19 -02:30
util.test.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00