From f4003edc581b5f169c6c3dc6cb4b45722b1e91eb Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Sat, 17 Oct 2026 23:31:11 +0800 Subject: [PATCH] =?UTF-8?q?test(backend):=20=E8=A6=86=E7=9B=96=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E9=99=90=E6=B5=81=E7=BC=BA=E7=9C=81=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fruitshorts/app/service/AppAuthServiceTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fruitshorts-app-api/src/test/java/com/fruitshorts/app/service/AppAuthServiceTest.java b/fruitshorts-app-api/src/test/java/com/fruitshorts/app/service/AppAuthServiceTest.java index a5f5f6e..4424ada 100644 --- a/fruitshorts-app-api/src/test/java/com/fruitshorts/app/service/AppAuthServiceTest.java +++ b/fruitshorts-app-api/src/test/java/com/fruitshorts/app/service/AppAuthServiceTest.java @@ -204,6 +204,17 @@ class AppAuthServiceTest { .hasMessageContaining("当前网络注册过于频繁"); } + @Test + void should_fallback_to_default_limit_when_config_is_missing() { + given(userMapper.selectCount(any())).willReturn(5L); + + assertThatThrownBy(() -> authService.register(emailRegister("abcd1234", null), "203.0.113.8")) + .isInstanceOf(ServiceException.class) + .satisfies(ex -> assertThat(((ServiceException) ex).getCode()) + .isEqualTo(ErrorCode.TOO_MANY_REQUESTS.getCode())) + .hasMessageContaining("当前网络注册过于频繁"); + } + @Test void should_not_limit_by_ip_when_ip_limit_is_zero() { stubHappyRegister();