Skip to content

Commit

Permalink
fix: fixed HbarLimitService unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

Revert "fixed shouldLimit v1"

This reverts commit 2f745e6f6188d7c4d84da931793544200420d073.

Reapply "fixed shouldLimit v1"

This reverts commit f280bbf311a4e407ed2c158d372581e2b8b36e25.

s

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

Revert "fix: fixed HbarLimitService unit test"

This reverts commit ec28eee.

Reapply "fix: fixed HbarLimitService unit test"

This reverts commit e27bae25cb51f5a49db525c5e66e08b3da2c3c15.
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
  • Loading branch information
quiet-node committed Feb 1, 2025
1 parent a5b4271 commit 357c68d
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 = prepend0x(AccountId.fromString(operatorEnv.OPERATOR_ID_MAIN).toSolidityAddress());

withOverriddenEnvsInMochaTest(operatorEnv, () => {
describe('based on evmAddress', async function () {
Expand Down Expand Up @@ -877,7 +877,10 @@ describe('HBAR Rate Limit Service', function () {
expect(operatorPlan.amountSpent).to.eq(expense);
};

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
Expand Down Expand Up @@ -950,7 +953,10 @@ describe('HBAR Rate Limit Service', function () {
).to.eventually.equal(expected);
};

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) => {
withOverriddenEnvsInMochaTest(operatorEnv, () => {
Expand Down

0 comments on commit 357c68d

Please sign in to comment.