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

+1 -1
View File
@@ -5,7 +5,7 @@ import 'package:nontonki/pages/discover/widgets/cover_carousel.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
testWidgets('the cube turns and keeps the title on the poster', (tester) async {
testWidgets('should_turn_cube_and_keep_title_on_poster_when_carousel_pages', (tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
+14 -14
View File
@@ -28,7 +28,7 @@ Drama _drama(String id, {List<int> numbers = const [1, 2, 3]}) => Drama(
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
test('the constructor resolves the resume position of episode one', () async {
test('should_resolve_resume_position_of_episode_one_when_constructed', () async {
final history = FakeWatchHistory()..saved = const Duration(seconds: 4);
final logic = DiscoverLogic(history: history, drama: _drama('signal'));
@@ -39,7 +39,7 @@ void main() {
logic.dispose();
});
test('refreshPosition re-reads after the drama is swapped', () async {
test('should_reread_resume_position_when_drama_is_swapped', () async {
final history = FakeWatchHistory();
final logic = DiscoverLogic(history: history, drama: _drama('signal'));
@@ -54,7 +54,7 @@ void main() {
logic.dispose();
});
test('a list card without episodes resumes from the last watch', () async {
test('should_resume_from_last_watch_when_list_card_has_no_episodes', () async {
final history = FakeWatchHistory()
..saved = const Duration(seconds: 9)
..lastEpisode = 'signal-2';
@@ -68,7 +68,7 @@ void main() {
logic.dispose();
});
test('a list card without history has no resume position', () async {
test('should_have_no_resume_position_when_list_card_has_no_history', () async {
final history = FakeWatchHistory();
final logic = DiscoverLogic(
history: history,
@@ -80,7 +80,7 @@ void main() {
logic.dispose();
});
test('selectCategory stores the index and notifies once', () {
test('should_store_index_and_notify_once_when_category_is_selected', () {
final logic = DiscoverLogic(history: FakeWatchHistory(), drama: _drama('s'));
var notifications = 0;
logic.addListener(() => notifications++);
@@ -92,7 +92,7 @@ void main() {
logic.dispose();
});
test('search visibility follows the flag or the typed text', () {
test('should_show_search_when_flag_is_on_or_text_is_typed', () {
final logic = DiscoverLogic(history: FakeWatchHistory(), drama: _drama('s'));
expect(logic.showSearch, isFalse);
@@ -109,7 +109,7 @@ void main() {
logic.dispose();
});
test('dramaFor matches by id and tolerates a missing id', () {
test('should_match_by_id_and_tolerate_missing_id_when_looking_up_drama', () {
final logic = DiscoverLogic(history: FakeWatchHistory(), drama: _drama('s'));
final catalog = [_drama('signal'), _drama('city')];
@@ -120,7 +120,7 @@ void main() {
logic.dispose();
});
test('syncDrama only adopts a drama while the page is active', () {
test('should_adopt_drama_only_when_page_is_active', () {
final history = FakeWatchHistory();
final logic = DiscoverLogic(history: history, drama: _drama('signal'));
@@ -163,7 +163,7 @@ void main() {
logic.dispose();
});
testWidgets('a search request opens and focuses the field when active', (
testWidgets('should_open_and_focus_field_when_search_is_requested_and_page_is_active', (
tester,
) async {
final logic = DiscoverLogic(history: FakeWatchHistory(), drama: _drama('s'));
@@ -196,7 +196,7 @@ void main() {
logic.dispose();
});
testWidgets('a hidden page never opens or focuses the search field', (
testWidgets('should_keep_search_field_closed_when_page_is_hidden', (
tester,
) async {
final logic = DiscoverLogic(history: FakeWatchHistory(), drama: _drama('s'));
@@ -231,7 +231,7 @@ void main() {
logic.dispose();
});
testWidgets('act returns the choice for a page and forwards it when embedded', (
testWidgets('should_return_choice_and_forward_it_when_act_runs_embedded', (
tester,
) async {
final logic = DiscoverLogic(history: FakeWatchHistory(), drama: _drama('s'));
@@ -278,7 +278,7 @@ void main() {
logic.dispose();
});
testWidgets('a card without playable media shows the artwork notice', (
testWidgets('should_show_artwork_notice_when_card_has_no_playable_media', (
tester,
) async {
final logic = DiscoverLogic(history: FakeWatchHistory(), drama: _drama('s'));
@@ -306,7 +306,7 @@ void main() {
logic.dispose();
});
testWidgets('an embedded card forwards the chosen drama', (tester) async {
testWidgets('should_forward_chosen_drama_when_card_is_embedded', (tester) async {
final logic = DiscoverLogic(history: FakeWatchHistory(), drama: _drama('s'));
late BuildContext context;
Drama? selected;
@@ -333,7 +333,7 @@ void main() {
logic.dispose();
});
test('notify after dispose is a no-op', () {
test('should_do_nothing_when_notifying_after_dispose', () {
final logic = DiscoverLogic(history: FakeWatchHistory(), drama: _drama('s'));
var notifications = 0;
logic.addListener(() => notifications++);