Skip to content

Commit

Permalink
test: updated tests to handle case with transaction fee
Browse files Browse the repository at this point in the history
  • Loading branch information
frazarshad committed Apr 16, 2024
1 parent 4b69982 commit 6c40582
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/e2e/specs/swap-tokens.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
describe('Swap Tokens Tests', () => {
const limitFloat = float => parseFloat(float.toFixed(5));
const amountToSwap = 0.001;
const transactionFee = 0.2;
const phrasesList = {
emerynet: {
walletButton: 'li[data-value="testnet"]',
Expand Down Expand Up @@ -89,7 +90,10 @@ describe('Swap Tokens Tests', () => {
.should('be.visible');

cy.getTokenAmount('IST').then(amount =>
expect(amount).to.equal(limitFloat(istBalance - amountToSwap))
expect(amount).to.be.oneOf([
limitFloat(istBalance - amountToSwap),
limitFloat(istBalance - amountToSwap - transactionFee),
])
);
});

Expand Down Expand Up @@ -117,7 +121,10 @@ describe('Swap Tokens Tests', () => {
.should('be.visible');

cy.getTokenAmount('IST').then(amount =>
expect(amount).to.equal(limitFloat(ISTbalance + amountToSwap))
expect(amount).to.be.oneOf([
limitFloat(ISTbalance + amountToSwap),
limitFloat(ISTbalance + amountToSwap - transactionFee),
])
);
});
});

0 comments on commit 6c40582

Please sign in to comment.