From c65763634dbe8b0f3c7af7fe2abedfe9a56cad29 Mon Sep 17 00:00:00 2001 From: Torres-ssf Date: Mon, 9 Dec 2024 14:33:58 -0300 Subject: [PATCH] add test case to validate block height precondition --- .../account/src/providers/provider.test.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/account/src/providers/provider.test.ts b/packages/account/src/providers/provider.test.ts index 226c6642e00..8b7a52a6b13 100644 --- a/packages/account/src/providers/provider.test.ts +++ b/packages/account/src/providers/provider.test.ts @@ -2269,4 +2269,24 @@ Supported fuel-core version: ${mock.supportedVersion}.` expect(fetchChainAndNodeInfo).toHaveBeenCalledTimes(2); }); + + test('should ensure required block height will be validated', async () => { + await expectToThrowFuelError( + () => + setupTestProviderAndWallets({ + providerOptions: { + requestMiddleware: (request) => { + request.headers = { + REQUIRED_FUEL_BLOCK_HEIGHT: '99999999', + }; + return request; + }, + }, + }), + { + code: FuelError.CODES.INVALID_REQUEST, + message: 'Block height precondition failed', + } + ); + }); });