@@ -8,12 +8,14 @@ const {
88 handleModifyActionMock,
99 handleOrderActionMock,
1010 handleOrdersActionMock,
11+ handleReplaceActionMock,
1112} = vi . hoisted ( ( ) => ( {
1213 handleBreakEvenStopActionMock : vi . fn ( ( ) => Promise . resolve ( undefined ) ) ,
1314 handleCancelActionMock : vi . fn ( ( ) => Promise . resolve ( undefined ) ) ,
1415 handleModifyActionMock : vi . fn ( ( ) => Promise . resolve ( undefined ) ) ,
1516 handleOrderActionMock : vi . fn ( ( ) => Promise . resolve ( undefined ) ) ,
1617 handleOrdersActionMock : vi . fn ( ( ) => Promise . resolve ( undefined ) ) ,
18+ handleReplaceActionMock : vi . fn ( ( ) => Promise . resolve ( undefined ) ) ,
1719} ) ) ;
1820
1921vi . mock ( "../../../../../../src/apps/cb/commands/order-handlers.js" , ( ) => ( {
@@ -22,6 +24,7 @@ vi.mock("../../../../../../src/apps/cb/commands/order-handlers.js", () => ({
2224 handleModifyAction : handleModifyActionMock ,
2325 handleOrderAction : handleOrderActionMock ,
2426 handleOrdersAction : handleOrdersActionMock ,
27+ handleReplaceAction : handleReplaceActionMock ,
2528} ) ) ;
2629
2730import { registerOrderCommands } from "../../../../../../src/apps/cb/commands/register/register-orders.js" ;
@@ -40,17 +43,19 @@ describe("order command topology", () => {
4043 vi . clearAllMocks ( ) ;
4144 } ) ;
4245
43- it ( "supports nested order get/list/cancel/modify commands" , async ( ) => {
46+ it ( "supports nested order get/list/cancel/replace/ modify commands" , async ( ) => {
4447 await run ( [ "order" , "get" , VALID_UUID ] ) ;
4548 await run ( [ "order" , "list" ] ) ;
4649 await run ( [ "order" , "cancel" , VALID_UUID ] ) ;
50+ await run ( [ "order" , "replace" , VALID_UUID ] ) ;
4751 await run ( [ "order" , "modify" , VALID_UUID , "--limitPrice" , "101.50" ] ) ;
4852 await run ( [ "order" , "modify" , VALID_UUID , "--takeProfitPrice" , "121.50" ] ) ;
4953 await run ( [ "order" , "breakeven" , VALID_UUID , "--buyPrice" , "100" , "--limitPrice" , "101.50" ] ) ;
5054
5155 expect ( handleOrderActionMock ) . toHaveBeenCalledWith ( VALID_UUID ) ;
5256 expect ( handleOrdersActionMock ) . toHaveBeenCalledWith ( null ) ;
5357 expect ( handleCancelActionMock ) . toHaveBeenCalledWith ( VALID_UUID ) ;
58+ expect ( handleReplaceActionMock ) . toHaveBeenCalledWith ( VALID_UUID ) ;
5459 expect ( handleModifyActionMock ) . toHaveBeenCalledWith ( VALID_UUID , { limitPrice : "101.50" } ) ;
5560 expect ( handleModifyActionMock ) . toHaveBeenCalledWith ( VALID_UUID , { takeProfitPrice : "121.50" } ) ;
5661 expect ( handleBreakEvenStopActionMock ) . toHaveBeenCalledWith ( VALID_UUID , {
@@ -71,6 +76,7 @@ describe("order command topology", () => {
7176 expect ( handleOrderActionMock ) . not . toHaveBeenCalled ( ) ;
7277 expect ( handleOrdersActionMock ) . not . toHaveBeenCalled ( ) ;
7378 expect ( handleCancelActionMock ) . not . toHaveBeenCalled ( ) ;
79+ expect ( handleReplaceActionMock ) . not . toHaveBeenCalled ( ) ;
7480 expect ( handleModifyActionMock ) . not . toHaveBeenCalled ( ) ;
7581 expect ( handleBreakEvenStopActionMock ) . not . toHaveBeenCalled ( ) ;
7682 } ) ;
0 commit comments