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("AppSupplierOrderSupport")
class AppSupplierOrderSupportTest
{
    @Test
    @DisplayName("Tab 转 order_status")
    void resolveOrderStatus()
    {
        assertNull(AppSupplierOrderSupport.resolveOrderStatus(AppSupplierOrderRules.STATUS_TAB_ALL));
        assertEquals(TradeOrderRules.ORDER_STATUS_PENDING,
                AppSupplierOrderSupport.resolveOrderStatus(AppSupplierOrderRules.STATUS_TAB_PENDING));
        assertEquals(TradeOrderRules.ORDER_STATUS_COMPLETED,
                AppSupplierOrderSupport.resolveOrderStatus(AppSupplierOrderRules.STATUS_TAB_COMPLETED));
    }

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