Skip to content

Commit

Permalink
chore: see second last value for auction params
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Mar 5, 2025
1 parent 19f661a commit e15c3d1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
14 changes: 10 additions & 4 deletions test/e2e/specs/liquidation-reconstitution.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import {
webWalletURL,
webWalletSelectors,
tokens,
extractNumber,
} from '../test.utils';

describe('Liquidation Reconstitution Testing', () => {
let startTime;
const AGORIC_NET = Cypress.env('AGORIC_NET').trim();
const network =
{ local: 'local', emerynet: 'emerynet' }[AGORIC_NET] || 'testnet';

const checkLastestAuctionValue =
network === 'local' || network === 'emerynet' ? false : true;
const currentConfig = configMap[network];
const QUICK_WAIT =
AGORIC_NET === 'local' ? QUICK_WAIT_LOCAL : QUICK_WAIT_TESTNET;
Expand Down Expand Up @@ -545,7 +545,6 @@ describe('Liquidation Reconstitution Testing', () => {
cy.fetchVStorageData({
url: reserveURL,
field: 'shortfallBalance',
latest: true,
}).then(output => {
shortfallBalance = Number(
(Number(output.value.slice(1)) / 1_000_000).toFixed(2),
Expand Down Expand Up @@ -621,9 +620,11 @@ describe('Liquidation Reconstitution Testing', () => {

const expectedValue = 9.99;
cy.task('info', `Expected Value: ${expectedValue}`);
// TODO: temporarily check second last value
cy.fetchVStorageData({
url: auctionURL,
field: 'startPrice',
latest: checkLastestAuctionValue,
}).then(data => {
cy.calculateRatios(data, { hasDenom: true, useValue: false }).then(
result => {
Expand All @@ -637,9 +638,11 @@ describe('Liquidation Reconstitution Testing', () => {
it('should verify the value of startProceedsGoal', () => {
const expectedValue = 309.54;
cy.task('info', `Expected Value: ${expectedValue}`);
// TODO: temporarily check second last value
cy.fetchVStorageData({
url: auctionURL,
field: 'startProceedsGoal',
latest: checkLastestAuctionValue,
}).then(data => {
cy.calculateRatios(data, { hasDenom: false, useValue: true }).then(
result => {
Expand All @@ -653,9 +656,11 @@ describe('Liquidation Reconstitution Testing', () => {
it('should verify the value of startCollateral', () => {
const expectedValue = 45;
cy.task('info', `Expected Value: ${expectedValue}`);
// TODO: temporarily check second last value
cy.fetchVStorageData({
url: auctionURL,
field: 'startCollateral',
latest: checkLastestAuctionValue,
}).then(data => {
cy.calculateRatios(data, { hasDenom: false, useValue: true }).then(
result => {
Expand Down Expand Up @@ -697,9 +702,11 @@ describe('Liquidation Reconstitution Testing', () => {

const expectedValue = 31.414987;
cy.task('info', `Expected Value: ${expectedValue}`);
// TODO: temporarily check second last value
cy.fetchVStorageData({
url: auctionURL,
field: 'collateralAvailable',
latest: checkLastestAuctionValue,
}).then(data => {
cy.calculateRatios(data, { hasDenom: false, useValue: true }).then(
result => {
Expand All @@ -720,7 +727,6 @@ describe('Liquidation Reconstitution Testing', () => {
cy.fetchVStorageData({
url: reserveURL,
field: 'shortfallBalance',
latest: true,
})
.then(newBalanceObj => {
let newBalance = Number(
Expand Down
13 changes: 10 additions & 3 deletions test/e2e/specs/liquidation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import {
QUICK_WAIT_TESTNET,
THIRTY_SECONDS,
tokens,
extractNumber,
} from '../test.utils';

describe('Liquidation Testing', () => {
let startTime;
const AGORIC_NET = Cypress.env('AGORIC_NET').trim();
const network =
{ local: 'local', emerynet: 'emerynet' }[AGORIC_NET] || 'testnet';
const checkLastestAuctionValue =
network === 'local' || network === 'emerynet' ? false : true;

const currentConfig = configMap[network];
const QUICK_WAIT =
Expand Down Expand Up @@ -540,7 +541,6 @@ describe('Liquidation Testing', () => {
cy.fetchVStorageData({
url: reserveURL,
field: 'shortfallBalance',
latest: true,
}).then(output => {
shortfallBalance = Number(
(Number(output.value.slice(1)) / 1_000_000).toFixed(2),
Expand Down Expand Up @@ -629,9 +629,11 @@ describe('Liquidation Testing', () => {

const expectedValue = 9.99;
cy.task('info', `Expected Value: ${expectedValue}`);
// TODO: temporarily check second last value
cy.fetchVStorageData({
url: auctionURL,
field: 'startPrice',
latest: checkLastestAuctionValue,
}).then(data => {
cy.calculateRatios(data, { hasDenom: true, useValue: false }).then(
result => {
Expand All @@ -645,9 +647,11 @@ describe('Liquidation Testing', () => {
it('should verify the value of startProceedsGoal', () => {
const expectedValue = 309.54;
cy.task('info', `Expected Value: ${expectedValue}`);
// TODO: temporarily check second last value
cy.fetchVStorageData({
url: auctionURL,
field: 'startProceedsGoal',
latest: checkLastestAuctionValue,
}).then(data => {
cy.calculateRatios(data, { hasDenom: false, useValue: true }).then(
result => {
Expand All @@ -661,9 +665,11 @@ describe('Liquidation Testing', () => {
it('should verify the value of startCollateral', () => {
const expectedValue = 45;
cy.task('info', `Expected Value: ${expectedValue}`);
// TODO: temporarily check second last value
cy.fetchVStorageData({
url: auctionURL,
field: 'startCollateral',
latest: checkLastestAuctionValue,
}).then(data => {
cy.calculateRatios(data, { hasDenom: false, useValue: true }).then(
result => {
Expand Down Expand Up @@ -706,9 +712,11 @@ describe('Liquidation Testing', () => {

const expectedValue = 9.659301;
cy.task('info', `Expected Value: ${expectedValue}`);
// TODO: temporarily check second last value
cy.fetchVStorageData({
url: auctionURL,
field: 'collateralAvailable',
latest: checkLastestAuctionValue,
}).then(data => {
cy.calculateRatios(data, { hasDenom: false, useValue: true }).then(
result => {
Expand Down Expand Up @@ -806,7 +814,6 @@ describe('Liquidation Testing', () => {
cy.fetchVStorageData({
url: reserveURL,
field: 'shortfallBalance',
latest: true,
})
.then(newBalanceObj => {
let newBalance = Number(
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Cypress.Commands.add('provisionFromFaucet', (walletAddress, command) => {
});

Cypress.Commands.add('fetchVStorageData', params => {
const { url, field, latest = false } = params;
const { url, field, latest = true } = params;
cy.request(url).then(response => {
expect(response.status).to.eq(200);
cy.task('info', `Data fetched successfully for ${field}`);
Expand Down

0 comments on commit e15c3d1

Please sign in to comment.