fix: 1642 show in type column if order is pegged or LP (#1697)
* fix: #1642 show in type column if order is pegged or LP * Update libs/orders/src/lib/components/order-list/order-list.spec.tsx Co-authored-by: Matthew Russell <mattrussell36@gmail.com> * Update libs/orders/src/lib/components/order-list/order-list.spec.tsx Co-authored-by: Matthew Russell <mattrussell36@gmail.com> Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
This commit is contained in:
parent
4d8abeb2a3
commit
e25f0085eb
@ -33,7 +33,7 @@ const defaultProps: OrderListTableProps = {
|
|||||||
|
|
||||||
const generateJsx = (
|
const generateJsx = (
|
||||||
props: Partial<OrderListTableProps> = defaultProps,
|
props: Partial<OrderListTableProps> = defaultProps,
|
||||||
context: PartialDeep<VegaWalletContextShape> = { keypair: { pub: '0x123' } }
|
context: PartialDeep<VegaWalletContextShape> = { pubKey: '0x123' }
|
||||||
) => {
|
) => {
|
||||||
return (
|
return (
|
||||||
<MockedProvider>
|
<MockedProvider>
|
||||||
@ -166,7 +166,7 @@ describe('OrderListTable', () => {
|
|||||||
expect(mockCancel).toHaveBeenCalledWith(order);
|
expect(mockCancel).toHaveBeenCalledWith(order);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('doesnt show buttons for liquidity provision orders', async () => {
|
it('shows if an order is a liquidity provision order and does not show order actions', async () => {
|
||||||
const order = generateOrder({
|
const order = generateOrder({
|
||||||
type: OrderType.TYPE_LIMIT,
|
type: OrderType.TYPE_LIMIT,
|
||||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||||
@ -178,10 +178,12 @@ describe('OrderListTable', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const amendCell = getAmendCell();
|
const amendCell = getAmendCell();
|
||||||
|
const typeCell = screen.getAllByRole('gridcell')[2];
|
||||||
|
expect(typeCell).toHaveTextContent('Liquidity provision');
|
||||||
expect(amendCell.queryAllByRole('button')).toHaveLength(0);
|
expect(amendCell.queryAllByRole('button')).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('doesnt show buttons for pegged orders', async () => {
|
it('shows if an order is a pegged order and does not show order actions', async () => {
|
||||||
const order = generateOrder({
|
const order = generateOrder({
|
||||||
type: OrderType.TYPE_LIMIT,
|
type: OrderType.TYPE_LIMIT,
|
||||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||||
@ -195,6 +197,8 @@ describe('OrderListTable', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const amendCell = getAmendCell();
|
const amendCell = getAmendCell();
|
||||||
|
const typeCell = screen.getAllByRole('gridcell')[2];
|
||||||
|
expect(typeCell).toHaveTextContent('Pegged');
|
||||||
expect(amendCell.queryAllByRole('button')).toHaveLength(0);
|
expect(amendCell.queryAllByRole('button')).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -221,7 +225,7 @@ describe('OrderListTable', () => {
|
|||||||
OrderStatus.STATUS_FILLED,
|
OrderStatus.STATUS_FILLED,
|
||||||
OrderStatus.STATUS_REJECTED,
|
OrderStatus.STATUS_REJECTED,
|
||||||
OrderStatus.STATUS_STOPPED,
|
OrderStatus.STATUS_STOPPED,
|
||||||
])('doesnt show buttons for %s orders', async (status) => {
|
])('does not show buttons for %s orders', async (status) => {
|
||||||
const order = generateOrder({
|
const order = generateOrder({
|
||||||
type: OrderType.TYPE_LIMIT,
|
type: OrderType.TYPE_LIMIT,
|
||||||
status,
|
status,
|
||||||
|
@ -144,9 +144,12 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
|||||||
<AgGridColumn
|
<AgGridColumn
|
||||||
field="type"
|
field="type"
|
||||||
valueFormatter={({
|
valueFormatter={({
|
||||||
|
data: order,
|
||||||
value,
|
value,
|
||||||
}: VegaValueFormatterParams<Order, 'type'>) => {
|
}: VegaValueFormatterParams<Order, 'type'>) => {
|
||||||
if (!value) return '-';
|
if (!value) return '-';
|
||||||
|
if (order.peggedOrder) return t('Pegged');
|
||||||
|
if (order.liquidityProvision) return t('Liquidity provision');
|
||||||
return OrderTypeMapping[value];
|
return OrderTypeMapping[value];
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user