feat: add EstimatePosition mock
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
accountsQuery,
|
||||
amendGeneralAccountBalance,
|
||||
estimateFeesQuery,
|
||||
estimatePositionQuery,
|
||||
} from '@vegaprotocol/mock';
|
||||
import type { OrderSubmission } from '@vegaprotocol/wallet';
|
||||
import { createOrder } from '../support/create-order';
|
||||
@@ -51,6 +52,9 @@ describe(
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(req, 'EstimateFee', estimateFeesQuery());
|
||||
});
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(req, 'EstimatePosition', estimatePositionQuery());
|
||||
});
|
||||
cy.mockSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.wait('@Markets');
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
networkParamsQuery,
|
||||
nodeGuardQuery,
|
||||
ordersQuery,
|
||||
estimatePositionQuery,
|
||||
positionsQuery,
|
||||
proposalListQuery,
|
||||
statisticsQuery,
|
||||
@@ -158,6 +159,7 @@ const mockTradingPage = (
|
||||
aliasGQLQuery(req, 'Withdrawals', withdrawalsQuery());
|
||||
aliasGQLQuery(req, 'NetworkParams', networkParamsQuery());
|
||||
aliasGQLQuery(req, 'EstimateFees', estimateFeesQuery());
|
||||
aliasGQLQuery(req, 'EstimatePosition', estimatePositionQuery());
|
||||
aliasGQLQuery(req, 'ProposalsList', proposalListQuery());
|
||||
aliasGQLQuery(req, 'Deposits', depositsQuery());
|
||||
};
|
||||
|
||||
@@ -23,5 +23,6 @@ export * from '../orders/src/lib/components/order-data-provider/orders.mock';
|
||||
export * from '../positions/src/lib/positions.mock';
|
||||
export * from '../network-parameters/src/network-params.mock';
|
||||
export * from '../wallet/src/connect-dialog/chain-id.mock';
|
||||
export * from '../positions/src/lib/estimate-position.mock';
|
||||
export * from '../trades/src/lib/trades.mock';
|
||||
export * from '../withdraws/src/lib/withdrawal.mock';
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import merge from 'lodash/merge';
|
||||
import type { EstimatePositionQuery } from './__generated__/Positions';
|
||||
|
||||
export const estimatePositionQuery = (
|
||||
override?: PartialDeep<EstimatePositionQuery>
|
||||
): EstimatePositionQuery => {
|
||||
const defaultResult: EstimatePositionQuery = {
|
||||
estimatePosition: {
|
||||
__typename: 'PositionEstimate',
|
||||
margin: {
|
||||
bestCase: {
|
||||
collateralReleaseLevel: '100',
|
||||
initialLevel: '50',
|
||||
maintenanceLevel: '20',
|
||||
searchLevel: '30',
|
||||
},
|
||||
worstCase: {
|
||||
collateralReleaseLevel: '110',
|
||||
initialLevel: '60',
|
||||
maintenanceLevel: '30',
|
||||
searchLevel: '40',
|
||||
},
|
||||
},
|
||||
liquidation: {
|
||||
bestCase: {
|
||||
including_buy_orders: '1',
|
||||
including_sell_orders: '1',
|
||||
open_volume_only: '1',
|
||||
},
|
||||
worstCase: {
|
||||
including_buy_orders: '1',
|
||||
including_sell_orders: '1',
|
||||
open_volume_only: '1',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
return merge(defaultResult, override);
|
||||
};
|
||||
Reference in New Issue
Block a user