From fd338c7400bd85f7d4e4ffa77df6028c08c3a41c Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Fri, 19 May 2023 17:55:08 +0300 Subject: [PATCH] fix(orders): cancel all and pegged orders amendable (#3843) --- apps/trading-e2e/src/integration/trading-orders.cy.ts | 6 ++---- .../components/order-list-manager/order-list-manager.tsx | 6 ++---- .../src/lib/components/order-list/order-list.spec.tsx | 4 ++-- libs/orders/src/lib/components/order-list/order-list.tsx | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/apps/trading-e2e/src/integration/trading-orders.cy.ts b/apps/trading-e2e/src/integration/trading-orders.cy.ts index bb17b4ff0..5ce874517 100644 --- a/apps/trading-e2e/src/integration/trading-orders.cy.ts +++ b/apps/trading-e2e/src/integration/trading-orders.cy.ts @@ -482,7 +482,7 @@ describe('amend and cancel order', { tags: '@smoke' }, () => { testOrderCancellation(order); }); }); - it('must be able to cancel all orders on a market', () => { + it('must be able to cancel all orders on all markets', () => { // 7003-MORD-009 // 7003-MORD-010 // 7003-MORD-011 @@ -496,9 +496,7 @@ describe('amend and cancel order', { tags: '@smoke' }, () => { .should('have.text', 'Cancel all') .then(($btn) => { cy.wrap($btn).click({ force: true }); - const order: OrderCancellation = { - marketId: 'market-0', - }; + const order: OrderCancellation = {}; testOrderCancellation(order); }); }); diff --git a/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx b/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx index ffb6706c0..4e2d2598b 100644 --- a/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx +++ b/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx @@ -133,11 +133,9 @@ export const OrderListManager = ({ const cancelAll = useCallback(() => { create({ - orderCancellation: { - marketId, - }, + orderCancellation: {}, }); - }, [create, marketId]); + }, [create]); return ( <> 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 574f089c3..ddd348344 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 @@ -226,8 +226,8 @@ describe('OrderListTable', () => { const amendCell = getAmendCell(); const typeCell = screen.getAllByRole('gridcell')[2]; expect(typeCell).toHaveTextContent('Mid - 10.0 Peg limit'); - expect(amendCell.queryByTestId('edit')).not.toBeInTheDocument(); - expect(amendCell.queryByTestId('cancel')).not.toBeInTheDocument(); + expect(amendCell.queryByTestId('edit')).toBeInTheDocument(); + expect(amendCell.queryByTestId('cancel')).toBeInTheDocument(); }); it.each([ 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 2f6f6901a..976558c90 100644 --- a/libs/orders/src/lib/components/order-list/order-list.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.tsx @@ -329,7 +329,7 @@ export const isOrderActive = (status: Schema.OrderStatus) => { }; export const isOrderAmendable = (order: Order | undefined) => { - if (!order || order.peggedOrder || order.liquidityProvision) { + if (!order || order.liquidityProvision) { return false; }