test(salon): 清理微信号必填遗留用例,改为校验空值归一为 null
自动发布开发环境 Nacos 配置 / publish (push) Successful in 23s

This commit is contained in:
2026-11-08 02:10:34 +08:00
parent b8904d92d1
commit 2eefae834a
@@ -2,19 +2,23 @@ package com.xiaowang.jayucloud.salon.core.modules.user.support;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertNull;
class UserProfileFieldSupportTest { class UserProfileFieldSupportTest {
/**
* 微信号已改为选填:空值与空白统一归一为 null,不再抛出必填异常。
*/
@Test @Test
void nailArtistWechatIdIsOptional() { void blankWechatIdIsNormalizedToNull() {
assertDoesNotThrow(() -> UserProfileFieldSupport.requireWechatIdForServiceUser(3, null)); assertNull(UserProfileFieldSupport.normalizeOptionalText(null));
assertNull(UserProfileFieldSupport.normalizeOptionalText(""));
assertNull(UserProfileFieldSupport.normalizeOptionalText(" "));
} }
@Test @Test
void managerWechatIdRemainsRequired() { void nonBlankWechatIdIsTrimmed() {
assertThrows(IllegalArgumentException.class, assertEquals("wx_123", UserProfileFieldSupport.normalizeOptionalText(" wx_123 "));
() -> UserProfileFieldSupport.requireWechatIdForServiceUser(2, null));
} }
} }