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

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

@DisplayName("TradingPartnerLoginNameGenerator")
class TradingPartnerLoginNameGeneratorTest
{
    @Test
    @DisplayName("汉字拼音首字母+id")
    void chineseInitials()
    {
        assertEquals("zxgys12", TradingPartnerLoginNameGenerator.generate("扎西供应商", 12L));
    }

    @Test
    @DisplayName("英文名称保留字母")
    void asciiName()
    {
        assertEquals("vet99", TradingPartnerLoginNameGenerator.generate("Vet", 99L));
    }

    @Test
    @DisplayName("空名称回退 user")
    void emptyName()
    {
        String login = TradingPartnerLoginNameGenerator.generate("", 5L);
        assertTrue(login.startsWith("user"));
        assertTrue(login.endsWith("5"));
    }
}
