package com.ruoyi.web.modules.trading.support;

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 com.ruoyi.common.exception.ServiceException;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

@DisplayName("AppDistributorOrderSupport")
class AppDistributorOrderSupportTest
{
    @Test
    @DisplayName("状态筛选映射")
    void resolveOrderStatus()
    {
        assertNull(AppDistributorOrderSupport.resolveOrderStatus(AppDistributorOrderRules.STATUS_TAB_ALL));
        assertEquals(TradeOrderRules.ORDER_STATUS_PENDING,
                AppDistributorOrderSupport.resolveOrderStatus(AppDistributorOrderRules.STATUS_TAB_PENDING));
        assertEquals(TradeOrderRules.ORDER_STATUS_COMPLETED,
                AppDistributorOrderSupport.resolveOrderStatus(AppDistributorOrderRules.STATUS_TAB_COMPLETED));
    }

    @Test
    @DisplayName("非法状态")
    void invalidTab()
    {
        assertThrows(ServiceException.class, () -> AppDistributorOrderSupport.normalizeStatusTab("X"));
    }
}
