|
1 |
| -import { assert } from "chai"; |
| 1 | +import { assert, expect } from "chai"; |
2 | 2 | import { MockAgent, MockPool } from "undici";
|
3 | 3 |
|
4 | 4 | import { HttpProvider } from "../../../../src/internal/core/providers/http";
|
5 | 5 | import { ERRORS } from "../../../../src/internal/core/errors-list";
|
6 | 6 | import { SuccessfulJsonRpcResponse } from "../../../../src/internal/util/jsonrpc";
|
7 | 7 | import { expectHardhatError } from "../../../helpers/errors";
|
| 8 | +import { ProviderError } from "../../../../src/internal/core/providers/errors"; |
8 | 9 |
|
9 | 10 | const TOO_MANY_REQUEST_STATUS = 429;
|
10 | 11 |
|
@@ -93,5 +94,19 @@ describe("HttpProvider", function () {
|
93 | 94 | assert.equal(result, successResponse.result);
|
94 | 95 | assert(tooManyRequestsReturned);
|
95 | 96 | });
|
| 97 | + |
| 98 | + it("should throw an error if it receives hardhat_setLedgerOutputEnabled as a method", async function () { |
| 99 | + const mockPool = makeMockPool(url); |
| 100 | + mockPool |
| 101 | + .intercept({ method: "POST", path: "/" }) |
| 102 | + .reply(200, successResponse); |
| 103 | + const provider = new HttpProvider(url, networkName, {}, 20000, mockPool); |
| 104 | + await expect( |
| 105 | + provider.request({ method: "hardhat_setLedgerOutputEnabled" }) |
| 106 | + ).to.be.eventually.rejectedWith( |
| 107 | + ProviderError, |
| 108 | + "hardhat_setLedgerOutputEnabled - Method not supported" |
| 109 | + ); |
| 110 | + }); |
96 | 111 | });
|
97 | 112 | });
|
0 commit comments