diff --git a/packages/relay/tests/lib/services/hbarLimitService/hbarLimitService.spec.ts b/packages/relay/tests/lib/services/hbarLimitService/hbarLimitService.spec.ts index c39ffe7f6..048e0a39e 100644 --- a/packages/relay/tests/lib/services/hbarLimitService/hbarLimitService.spec.ts +++ b/packages/relay/tests/lib/services/hbarLimitService/hbarLimitService.spec.ts @@ -24,7 +24,6 @@ import { AccountId, Hbar } from '@hashgraph/sdk'; import chai, { expect } from 'chai'; import chaiAsPromised from 'chai-as-promised'; import { randomBytes, uuidV4 } from 'ethers'; -import { Long } from 'long'; import pino, { Logger } from 'pino'; import { Counter, Gauge, Registry } from 'prom-client'; import sinon from 'sinon'; @@ -189,12 +188,13 @@ describe('HBAR Rate Limit Service', function () { }); describe('shouldLimit', function () { - const operatorEnvs = [{ OPERATOR_ID_MAIN: ConfigService.get('OPERATOR_ID_MAIN') }, { OPERATOR_ID_MAIN: null }]; + const operatorEnvs = [ + { OPERATOR_ID_MAIN: ConfigService.get('OPERATOR_ID_MAIN') }, + { OPERATOR_ID_MAIN: zeroAddress() }, + ]; operatorEnvs.forEach((operatorEnv) => { - const operatorAddress = operatorEnv.OPERATOR_ID_MAIN - ? prepend0x(AccountId.fromString(operatorEnv.OPERATOR_ID_MAIN).toSolidityAddress()) - : zeroAddress(); + const operatorAddress = AccountId.fromString(operatorEnv.OPERATOR_ID_MAIN).toSolidityAddress(); withOverriddenEnvsInMochaTest(operatorEnv, () => { describe('based on evmAddress', async function () { diff --git a/packages/relay/tests/lib/utils.spec.ts b/packages/relay/tests/lib/utils.spec.ts index 4d97d1198..973b921ac 100644 --- a/packages/relay/tests/lib/utils.spec.ts +++ b/packages/relay/tests/lib/utils.spec.ts @@ -199,15 +199,10 @@ describe('Utils', () => { OPERATOR_KEY_MAIN: privateKeys[0].keyValue, }, () => { - it('should return null and log a warning if operatorId is missing', () => { - const warnSpy = sinon.spy(logger, 'warn'); - - const operator = Utils.getOperator(logger); - - expect(operator).to.be.null; - expect(warnSpy.calledOnce).to.be.true; - expect(warnSpy.firstCall.args[0]).to.equal('Invalid operatorId or operatorKey for main client.'); - warnSpy.restore(); + it('should throw error if operatorId is missing', () => { + expect(() => Utils.getOperator(logger)).to.throw( + 'Configuration error: OPERATOR_ID_MAIN is a mandatory configuration for relay operation.', + ); }); }, );