Skip to content

Commit

Permalink
fix: moved confirming plan's validity logic to createAliasForNonBasic…
Browse files Browse the repository at this point in the history
…Plans()

Signed-off-by: Logan Nguyen <[email protected]>
  • Loading branch information
quiet-node committed Oct 24, 2024
1 parent ebeb7ad commit 0b802e9
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions packages/server/tests/acceptance/hbarLimiter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,14 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () {
mockTTL,
);

const plan = await ethAddressSpendingPlanRepository.findByAddress(aliasAccount.address, requestDetails);
expect(plan.ethAddress).to.eq(aliasAccount.address);
expect(plan.planId).to.eq(hbarSpendingPlan.id);
const spendingPlan = await hbarSpendingPlanRepository.findByIdWithDetails(plan.planId, requestDetails);
expect(spendingPlan.active).to.be.true;
expect(spendingPlan.amountSpent).to.eq(0);
expect(spendingPlan.subscriptionTier).to.eq(SubscriptionTier.PRIVILEGED);

return { aliasAccount, hbarSpendingPlan };
};

Expand Down Expand Up @@ -578,21 +586,6 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () {
await ethAddressSpendingPlanRepository.delete(priviledgedEvmAccount.address, requestDetails);
});

it('Should successfully add spending plans', async () => {
const plan = await ethAddressSpendingPlanRepository.findByAddress(
priviledgedEvmAccount.address,
requestDetails,
);

expect(plan.ethAddress).to.eq(priviledgedEvmAccount.address);
expect(plan.planId).to.eq(privilegedHbarSpendingPlan.id);

const spendingPlan = await hbarSpendingPlanRepository.findByIdWithDetails(plan.planId, requestDetails);
expect(spendingPlan.active).to.be.true;
expect(spendingPlan.amountSpent).to.eq(0);
expect(spendingPlan.subscriptionTier).to.eq(SubscriptionTier.PRIVILEGED);
});

it('Should increase the amount spent by the privileged spending plan', async () => {
const contract = await deployContract(largeContractJson, priviledgedEvmAccount.wallet);

Expand Down

0 comments on commit 0b802e9

Please sign in to comment.