111
This commit is contained in:
1 parent
4e1c65acfa
commit
493e7ef804
1 file changed
+23
+23
@@ -27,6 +27,7 @@ import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.Answers.CALLS_REAL_METHODS;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -186,6 +187,28 @@ class HardOrderServiceImplInventoryTest {
|
||||
assertEquals(-2, request.getItems().get(0).getIncrCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证设备购买链路(/hard-api/ad/create-order 产生的 BELOW+CANTEEN_SPU 购物车)扣基础 canteen_spu.stock:
|
||||
* 请求不携带每日菜谱分池通道,也不查询每日菜谱接口——每日菜谱页面的线上/线下剩余不会变化。
|
||||
*/
|
||||
@Test
|
||||
void deviceCreateOrderDeductsBasicSpuStockWithoutDailyMenuPools() {
|
||||
prepareCart(1);
|
||||
CanteenSpuEntity product = productWithStock(9996);
|
||||
when(remoteCanteenSpuService.getInnerSpuListByIds(List.of(11L))).thenReturn(R.ok(List.of(product)));
|
||||
when(remoteCanteenSpuService.updateSkuStockIdempotent(any())).thenReturn(R.ok());
|
||||
|
||||
assertDoesNotThrow(() -> service.fastenerInventory(cashierOrder(), null, YesNoEnum.YES, null, null));
|
||||
|
||||
ArgumentCaptor<CanteenSpuUpdateStockReqDTO> captor = ArgumentCaptor.forClass(CanteenSpuUpdateStockReqDTO.class);
|
||||
verify(remoteCanteenSpuService).updateSkuStockIdempotent(captor.capture());
|
||||
CanteenSpuUpdateStockReqDTO request = captor.getValue();
|
||||
assertNull(request.getStockChannel());
|
||||
assertEquals(-1, request.getItems().get(0).getIncrCount());
|
||||
verify(remoteDailyMenuService, never()).listForOrderValidate(any(), any(), any());
|
||||
verify(remoteDailyMenuService, never()).getCanteenList(any(), any(), any(), any());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证线上预定每日菜谱订单退款恢复 ONLINE 池:下单扣的是 online_sold,退款必须还同一池,
|
||||
* 快照取线上剩余并携带日期餐段。
|
||||
|
||||
Reference in new issue
Block a user