From 05fb01802d6c65e6ac71b1af62c1167518692374 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Wed, 10 May 2023 06:04:10 -0600 Subject: [PATCH] Re-enable tests for subscription-based RPC methods (#18994) NetworkController doesn't handle `eth_subscribe` or `eth_unsubscribe` specially, but as it's supported by Infura, we want to make sure we exercise these RPC methods in the network client tests, even if it is just to ensure that they get passed through to the network. We had tests for these RPC methods, but they were commented out in c095b1accd00c8123f954633bf396ddea7b95eff when the network client code was extracted to a separate file. At the time we were considering adding subscription- and filter-based middleware to NetworkController, and so we commented out the tests for `eth_subscribe` and `eth_unsubscribe` temporarily until we could rewrite them in a way that would exercise the new middleware. We reverted that change in bd23a490133693a464c2f4ab1976181378a9f7bf, which meant that we could restore the existing tests, but it appears that this task was not caught during review. This commit takes care of restoring them. Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> --- .../controllers/network/provider-api-tests/shared-tests.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/scripts/controllers/network/provider-api-tests/shared-tests.ts b/app/scripts/controllers/network/provider-api-tests/shared-tests.ts index 6337bb56a..cf34302ce 100644 --- a/app/scripts/controllers/network/provider-api-tests/shared-tests.ts +++ b/app/scripts/controllers/network/provider-api-tests/shared-tests.ts @@ -295,9 +295,8 @@ export function testsForProviderType(providerType: ProviderType) { // tests on the core side. { name: 'net_listening', numberOfParameters: 0 }, - // TODO: Methods to add back when we add testing for subscribe middleware - // { name: 'eth_subscribe', numberOfParameters: 1 }, - // { name: 'eth_unsubscribe', numberOfParameters: 1 }, + { name: 'eth_subscribe', numberOfParameters: 1 }, + { name: 'eth_unsubscribe', numberOfParameters: 1 }, { name: 'custom_rpc_method', numberOfParameters: 1 }, { name: 'net_peerCount', numberOfParameters: 0 }, { name: 'parity_nextNonce', numberOfParameters: 1 },