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

+12 -12
View File
@@ -18,7 +18,7 @@ void main() {
final dramas = [_drama('signal'), _drama('city')];
test('the first catalog entry becomes the current drama', () {
test('should_make_first_catalog_entry_the_current_drama_when_catalog_loads', () {
final logic = HomeLogic(dramas);
expect(logic.currentDrama.id, 'signal');
@@ -30,11 +30,11 @@ void main() {
logic.dispose();
});
test('an empty catalog cannot build the shell', () {
test('should_not_build_shell_when_catalog_is_empty', () {
expect(() => HomeLogic(const []), throwsStateError);
});
test('a plain tab switch raises no request counter', () {
test('should_not_raise_request_counter_when_only_tab_switches', () {
final logic = HomeLogic(dramas);
var notifications = 0;
logic.addListener(() => notifications++);
@@ -50,7 +50,7 @@ void main() {
logic.dispose();
});
test('each select flag raises exactly its own counter', () {
test('should_raise_only_its_own_counter_when_each_select_flag_is_used', () {
final logic = HomeLogic(dramas);
logic.select(1, search: true);
@@ -71,7 +71,7 @@ void main() {
logic.dispose();
});
test('the watchlist shortcut defaults to the second section', () {
test('should_default_to_second_section_when_watchlist_shortcut_is_used', () {
final logic = HomeLogic(dramas);
logic.select(2, watchlist: true);
@@ -82,7 +82,7 @@ void main() {
logic.dispose();
});
test('openProfile and openLibrary disagree about the profile flag', () {
test('should_differ_on_profile_flag_when_open_profile_and_open_library_are_used', () {
final logic = HomeLogic(dramas);
logic.openProfile();
@@ -103,7 +103,7 @@ void main() {
logic.dispose();
});
test('system back returns home, and home itself opens the drawer', () {
test('should_return_home_and_open_drawer_when_system_back_is_pressed', () {
final logic = HomeLogic(dramas);
logic.onSystemBack();
@@ -134,7 +134,7 @@ void main() {
logic.dispose();
});
test('drawer state only notifies on an actual change', () {
test('should_notify_only_on_actual_change_when_drawer_state_is_set', () {
final logic = HomeLogic(dramas);
var notifications = 0;
logic.addListener(() => notifications++);
@@ -151,7 +151,7 @@ void main() {
logic.dispose();
});
test('drama and immersive callbacks update state', () {
test('should_update_state_when_drama_and_immersive_callbacks_fire', () {
final logic = HomeLogic(dramas);
logic.onDramaChanged(dramas[1]);
@@ -162,7 +162,7 @@ void main() {
logic.dispose();
});
test('my page actions map onto root tabs', () {
test('should_map_onto_root_tabs_when_my_page_actions_fire', () {
final logic = HomeLogic(dramas);
logic.myAction(MyPageAction.discover);
@@ -179,7 +179,7 @@ void main() {
logic.dispose();
});
test('notifying after dispose is a no-op', () {
test('should_do_nothing_when_notifying_after_dispose', () {
final logic = HomeLogic(dramas);
var notifications = 0;
logic.addListener(() => notifications++);
@@ -190,7 +190,7 @@ void main() {
expect(notifications, 0);
});
testWidgets('discover actions map onto root tabs', (tester) async {
testWidgets('should_map_onto_root_tabs_when_discover_actions_fire', (tester) async {
final logic = HomeLogic(dramas);
late BuildContext context;
await tester.pumpWidget(