Add Unit Tests for v3 Layer and All GetX Controllers
@srykaran 已經在處理了。
開始於 2026年3月13日。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 領域
- mobile-dev, testing
研究方向
從 pubspec.yaml 以及 test/api_service_test.dart 和 test/models/json/task_test.dart 中現有的模式開始。在 test/v3/ 和 test/modules/controllers/ 下新增列出的 helpers 和 tests,然後先執行 build_runner 和兩個指定範圍的 flutter test 指令,再執行完整測試套件。完成標準是全部 12 個 v3 tests 和 14 個 controller tests 均通過,並涵蓋指定的狀態、變更和邊界情況。
由索引模型根據 Issue 內容生成。
描述
Summary
The project has 91+ existing tests covering utilities, JSON models, routes, and tour UI — but the v3 data layer (12 files) and all 14 GetX controllers have zero unit test coverage. These are the most critical parts of the codebase: v3 contains the task database, network sync, and core models, while controllers hold all business logic and state management.
Motivation
- Controllers are the sole owners of business logic per the GetX architecture contract — regressions here break the entire UI silently
- The v3 layer handles live task data sync; bugs here cause data loss
- No test infrastructure exists yet for either layer, making refactors risky
Scope
Phase 1 — Test Infrastructure
- Add
test/v3/helpers.dart— shared setup for sqflite FFI, SharedPreferences mock, binding init - Add
test/modules/controllers/helpers.dart— GetX test mode setup (Get.testMode = true,Get.reset()) - Run
build_runnerto regenerate mocks
Phase 2 — V3 Unit Tests (12 files)
Models (test/v3/models/)
-
test/v3/models/task_test.dart—TaskfromJson/toJson, null fields, edge cases -
test/v3/models/annotation_test.dart—Annotationserialization -
test/v3/models/task_for_replica_test.dart—TaskForReplicamodel
Database (test/v3/db/)
-
test/v3/db/task_database_test.dart— open, CRUD operations (sqflite FFI) -
test/v3/db/update_test.dart— migration/update logic
Network (test/v3/net/)
-
test/v3/net/add_task_test.dart -
test/v3/net/complete_test.dart -
test/v3/net/delete_test.dart -
test/v3/net/fetch_test.dart -
test/v3/net/modify_test.dart -
test/v3/net/origin_test.dart
Champion (test/v3/champion/)
-
test/v3/champion/replica_test.dart— sync logic with mocked DB and origin
Phase 3 — Controller Unit Tests (14 files in test/modules/controllers/)
-
home_controller_test.dart— filterTasks, updateTags, reactive state, search -
splash_controller_test.dart— init flow, navigation state -
taskc_details_controller_test.dart— task init from args, field mutation, save -
settings_controller_test.dart— language change, directory pick, theme -
widget_controller_test.dart -
logs_controller_test.dart -
about_controller_test.dart -
detail_route_controller_test.dart -
manage_task_server_controller_test.dart— server add/remove, connection test -
reports_controller_test.dart -
profile_controller_test.dart -
permission_controller_test.dart -
onboarding_controller_test.dart -
manage_task_champion_creds_controller_test.dart
Acceptance Criteria
-
flutter test test/v3/passes with all 12 v3 tests green -
flutter test test/modules/controllers/passes with all 14 controller tests green -
flutter testfull suite passes without regression - Each controller test covers:
onInitstate, at least 2 state-mutating methods, and error/edge cases
Implementation Notes
- No new pub dependencies needed —
mockitoandsqflite_ffiare already inpubspec.yaml - Reference existing patterns in
test/api_service_test.dart(mock setup) andtest/models/json/task_test.dart(model tests) - All 14 controllers extend
GetxController— useGet.testMode = trueper test group - v3 net tests should mock
http.Clientvia@GenerateMocks([http.Client])
Labels
testing good first issue help wanted v3 controllers
- 主要語言
- Dart
- 星號
- 246
- 分支
- 184
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
CCExtractor/taskwarrior-flutter 的其他 Issue
-
Fix misaligned text "Select the directory" in settings tile可能重新可做 @alabeddev 於 241 天前認領,目前沒有進行中的 PR。 未關閉bug
難度 2/5 1-3 小時 新手友好度 68/100
CCExtractor/taskwarrior-flutter#639 · 2 則留言 ·
-
bug
難度 1/5 1 小時以內 新手友好度 85/100
-
Drawer should close automatically when navigating to a new screen可能重新可做 關聯的 PR 已關閉且未合併。 未關閉bug
難度 2/5 1-3 小時 新手友好度 68/100
-
enhancement
難度 4/5 3-5 天 新手友好度 52/100
-
Sensitive Credentials Stored in Plain Text Files Without Encryption可能重新可做 @sahu-virendra-1908 於 238 天前認領,目前沒有進行中的 PR。 未關閉bug
難度 5/5 一週以上 新手友好度 45/100
CCExtractor/taskwarrior-flutter#645 · 1 則留言 ·
查看 CCExtractor/taskwarrior-flutter 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 60/100
hiddify/hiddify-app#2668 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
toyota-connected/emb_cli#358 ·
維護者通常 1 天內回覆
-
area: import beta cluster: callers box improvements severity: minor status: confirmed type: bug
難度 2/5 1-3 小時 新手友好度 62/100
ibanner56/CallersCompendium#2366 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
ccch1mneyyy/dsh-Go#1777 ·
維護者通常 1 天內回覆
-
area: mobile documentation good first issue
難度 2/5 1-3 小時 新手友好度 76/100
CommandLineCoding/Elephant#383 ·
維護者通常 1 天內回覆