test(client): 用例名统一为 should_<期望>_when_<条件>(155/155)

为什么:红线第 8 条门禁立即生效,要求 Flutter 测试命名合规;此前 155 条用例名是英文自然语言
或中文描述,合规数 0/155,属存量欠账,按"先补齐再上新功能"在本批处理。

- 25 个测试文件、155 条用例改名,按「文件 + 旧名」精确定位,每条断言命中恰好 1 次才替换
- 只改名字字面量:改动行 155 删 + 155 增,无一行不含字符串字面量(断言与用例体零改动)
- 门禁:dart analyze lib test = No issues found;flutter test = 155 全过
This commit is contained in:
Vicky committed 2026-10-16 09:41:14 +08:00
1 parent 1853e1845c
commit 0e5d550b50
25 files changed
+155 -155

No files matched your search

+4 -4
View File
@@ -54,7 +54,7 @@ void main() {
);
}
test('should store the session and expose a signed-in state when register succeeds', () async {
test('should_store_session_and_expose_signed_in_state_when_register_succeeds', () async {
late AuthController auth;
final adapter = FakeHttpAdapter((options) async {
expect(options.uri.path, '/app/auth/register');
@@ -77,7 +77,7 @@ void main() {
expect((await AuthSessionStore().read())?.refreshToken, 'r1');
});
test('should refresh once and retry with the new token when a response carries code 401', () async {
test('should_refresh_once_and_retry_with_new_token_when_response_code_is_401', () async {
var calls = 0;
late AuthController auth;
final adapter = FakeHttpAdapter((options) async {
@@ -119,7 +119,7 @@ void main() {
expect(auth.accessToken, 'a2');
});
test('should clear the session when the refresh itself fails', () async {
test('should_clear_session_when_refresh_itself_fails', () async {
late AuthController auth;
final adapter = FakeHttpAdapter((options) async {
if (options.uri.path == '/app/auth/refresh') {
@@ -147,7 +147,7 @@ void main() {
expect(await AuthSessionStore().read(), isNull);
});
test('should clear the local session when sign out hits a server error', () async {
test('should_clear_local_session_when_sign_out_hits_server_error', () async {
late AuthController auth;
final adapter = FakeHttpAdapter((options) async {
if (options.uri.path == '/app/auth/logout') {
+3 -3
View File
@@ -45,7 +45,7 @@ void main() {
await tester.pumpAndSettle();
}
testWidgets('should show the email error and stay on the page when the form is empty', (tester) async {
testWidgets('should_show_email_error_and_stay_on_page_when_form_is_empty', (tester) async {
await pumpAuthPage(tester);
expect(find.text('Welcome back'), findsOneWidget);
@@ -57,7 +57,7 @@ void main() {
expect(find.text('Welcome back'), findsOneWidget);
});
testWidgets('should reject a weak password locally when only letters are typed', (tester) async {
testWidgets('should_reject_weak_password_locally_when_only_letters_are_typed', (tester) async {
await pumpAuthPage(tester);
await tester.enterText(find.byType(TextField).first, 'a@b.com');
@@ -68,7 +68,7 @@ void main() {
expect(find.text('Password needs both letters and numbers'), findsOneWidget);
});
testWidgets('should flip between sign in and sign up when the switch link is tapped', (tester) async {
testWidgets('should_flip_between_sign_in_and_sign_up_when_switch_link_is_tapped', (tester) async {
await pumpAuthPage(tester);
expect(find.text('Welcome back'), findsOneWidget);