Skip to content

Commit

Permalink
chore: update tests and round values when comparing
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Oct 11, 2024
1 parent 99e28ee commit 674c4f2
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 17 deletions.
43 changes: 35 additions & 8 deletions test/e2e/specs/liquidation-reconstitution.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
webWalletURL,
webWalletSelectors,
tokens,
extractNumber,
} from '../test.utils';

describe('Wallet App Test Cases', () => {
Expand Down Expand Up @@ -483,9 +484,15 @@ describe('Wallet App Test Cases', () => {
);
});
} else {
const propertyName = 'book0.startPrice';
const propertyName = 'startPrice';
const expectedValue = '9.99 IST/ATOM';
cy.verifyAuctionData(propertyName, expectedValue);
cy.task('info', `Expected Value: ${expectedValue}`);
cy.getAuctionParam(propertyName).then(value => {
const actualValue = Math.round(extractNumber(value));
const expectedValueRounded = Math.round(extractNumber(expectedValue));

expect(actualValue).to.eq(expectedValueRounded);
});
}
});

Expand All @@ -505,9 +512,15 @@ describe('Wallet App Test Cases', () => {
);
});
} else {
const propertyName = 'book0.startProceedsGoal';
const propertyName = 'startProceedsGoal';
const expectedValue = '309.54 IST';
cy.verifyAuctionData(propertyName, expectedValue);
cy.task('info', `Expected Value: ${expectedValue}`);
cy.getAuctionParam(propertyName).then(value => {
const actualValue = Math.round(extractNumber(value));
const expectedValueRounded = Math.round(extractNumber(expectedValue));

expect(actualValue).to.eq(expectedValueRounded);
});
}
});

Expand All @@ -527,9 +540,15 @@ describe('Wallet App Test Cases', () => {
);
});
} else {
const propertyName = 'book0.startCollateral';
const propertyName = 'startCollateral';
const expectedValue = '45 ATOM';
cy.verifyAuctionData(propertyName, expectedValue);
cy.task('info', `Expected Value: ${expectedValue}`);
cy.getAuctionParam(propertyName).then(value => {
const actualValue = Math.round(extractNumber(value));
const expectedValueRounded = Math.round(extractNumber(expectedValue));

expect(actualValue).to.eq(expectedValueRounded);
});
}
});
});
Expand Down Expand Up @@ -576,9 +595,17 @@ describe('Wallet App Test Cases', () => {
);
});
} else {
const propertyName = 'book0.collateralAvailable';
const propertyName = 'collateralAvailable';
const expectedValue = '31.414987 ATOM';
cy.verifyAuctionData(propertyName, expectedValue); // eslint-disable-line cypress/no-unnecessary-waiting
cy.task('info', `Expected Value: ${expectedValue}`);
cy.getAuctionParam(propertyName).then(value => {
const actualValue = Math.round(extractNumber(value));
const expectedValueRounded = Math.round(
extractNumber(expectedValue),
);

expect(actualValue).to.eq(expectedValueRounded);
});
}
});
},
Expand Down
41 changes: 33 additions & 8 deletions test/e2e/specs/liquidation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
QUICK_WAIT,
THIRTY_SECONDS,
tokens,
extractNumber,
} from '../test.utils';

describe('Wallet App Test Cases', () => {
Expand Down Expand Up @@ -485,9 +486,15 @@ describe('Wallet App Test Cases', () => {
);
});
} else {
const propertyName = 'book0.startPrice';
const propertyName = 'startPrice';
const expectedValue = '9.99 IST/ATOM';
cy.verifyAuctionData(propertyName, expectedValue);
cy.task('info', `Expected Value: ${expectedValue}`);
cy.getAuctionParam(propertyName).then(value => {
const actualValue = Math.round(extractNumber(value));
const expectedValueRounded = Math.round(extractNumber(expectedValue));

expect(actualValue).to.eq(expectedValueRounded);
});
}
});

Expand All @@ -507,9 +514,15 @@ describe('Wallet App Test Cases', () => {
);
});
} else {
const propertyName = 'book0.startProceedsGoal';
const propertyName = 'startProceedsGoal';
const expectedValue = '309.54 IST';
cy.verifyAuctionData(propertyName, expectedValue);
cy.task('info', `Expected Value: ${expectedValue}`);
cy.getAuctionParam(propertyName).then(value => {
const actualValue = Math.round(extractNumber(value));
const expectedValueRounded = Math.round(extractNumber(expectedValue));

expect(actualValue).to.eq(expectedValueRounded);
});
}
});

Expand All @@ -529,9 +542,15 @@ describe('Wallet App Test Cases', () => {
);
});
} else {
const propertyName = 'book0.startCollateral';
const propertyName = 'startCollateral';
const expectedValue = '45 ATOM';
cy.verifyAuctionData(propertyName, expectedValue);
cy.task('info', `Expected Value: ${expectedValue}`);
cy.getAuctionParam(propertyName).then(value => {
const actualValue = Math.round(extractNumber(value));
const expectedValueRounded = Math.round(extractNumber(expectedValue));

expect(actualValue).to.eq(expectedValueRounded);
});
}
});
});
Expand Down Expand Up @@ -571,9 +590,15 @@ describe('Wallet App Test Cases', () => {
);
});
} else {
const propertyName = 'book0.collateralAvailable';
const propertyName = 'collateralAvailable';
const expectedValue = '9.659301 ATOM';
cy.verifyAuctionData(propertyName, expectedValue); // eslint-disable-line cypress/no-unnecessary-waiting
cy.task('info', `Expected Value: ${expectedValue}`);
cy.getAuctionParam(propertyName).then(value => {
const actualValue = Math.round(extractNumber(value));
const expectedValueRounded = Math.round(extractNumber(expectedValue));

expect(actualValue).to.eq(expectedValueRounded);
});
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const balanceUrl =
: 'http://localhost:1317/cosmos/bank/v1beta1/balances/';
const COMMAND_TIMEOUT = configMap[network].COMMAND_TIMEOUT;

const agops = 'agops';
const agops = '/usr/src/agoric-sdk/packages/agoric-cli/bin/agops';

Cypress.Commands.add('addKeys', params => {
const { keyName, mnemonic, expectedAddress } = params;
Expand Down

0 comments on commit 674c4f2

Please sign in to comment.