From e25f0085ebfcf0aa686d5c5fc456cb49a60fccc8 Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Mon, 10 Oct 2022 16:17:38 +0100 Subject: [PATCH] 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 * Update libs/orders/src/lib/components/order-list/order-list.spec.tsx Co-authored-by: Matthew Russell Co-authored-by: Matthew Russell --- .../lib/components/order-list/order-list.spec.tsx | 12 ++++++++---- .../src/lib/components/order-list/order-list.tsx | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libs/orders/src/lib/components/order-list/order-list.spec.tsx b/libs/orders/src/lib/components/order-list/order-list.spec.tsx index b9395600e..f8fdacba5 100644 --- a/libs/orders/src/lib/components/order-list/order-list.spec.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.spec.tsx @@ -33,7 +33,7 @@ const defaultProps: OrderListTableProps = { const generateJsx = ( props: Partial = defaultProps, - context: PartialDeep = { keypair: { pub: '0x123' } } + context: PartialDeep = { pubKey: '0x123' } ) => { return ( @@ -166,7 +166,7 @@ describe('OrderListTable', () => { 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({ type: OrderType.TYPE_LIMIT, timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, @@ -178,10 +178,12 @@ describe('OrderListTable', () => { }); const amendCell = getAmendCell(); + const typeCell = screen.getAllByRole('gridcell')[2]; + expect(typeCell).toHaveTextContent('Liquidity provision'); 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({ type: OrderType.TYPE_LIMIT, timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, @@ -195,6 +197,8 @@ describe('OrderListTable', () => { }); const amendCell = getAmendCell(); + const typeCell = screen.getAllByRole('gridcell')[2]; + expect(typeCell).toHaveTextContent('Pegged'); expect(amendCell.queryAllByRole('button')).toHaveLength(0); }); @@ -221,7 +225,7 @@ describe('OrderListTable', () => { OrderStatus.STATUS_FILLED, OrderStatus.STATUS_REJECTED, OrderStatus.STATUS_STOPPED, - ])('doesnt show buttons for %s orders', async (status) => { + ])('does not show buttons for %s orders', async (status) => { const order = generateOrder({ type: OrderType.TYPE_LIMIT, status, diff --git a/libs/orders/src/lib/components/order-list/order-list.tsx b/libs/orders/src/lib/components/order-list/order-list.tsx index 91be880ce..e192ad84e 100644 --- a/libs/orders/src/lib/components/order-list/order-list.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.tsx @@ -144,9 +144,12 @@ export const OrderListTable = forwardRef( ) => { if (!value) return '-'; + if (order.peggedOrder) return t('Pegged'); + if (order.liquidityProvision) return t('Liquidity provision'); return OrderTypeMapping[value]; }} />