Skip to content

Commit

Permalink
Merge pull request #139 from Agoric/test/fix-for-transaction-fee
Browse files Browse the repository at this point in the history
test: updated tests to handle case with transaction fee
  • Loading branch information
samsiegart authored Apr 16, 2024
2 parents 4b69982 + 6c40582 commit 81c7a6d
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 81c7a6d

Please sign in to comment.