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
Phase 2 — V3 Unit Tests (12 files)
Models (test/v3/models/)
Database (test/v3/db/)
Network (test/v3/net/)
Champion (test/v3/champion/)
Phase 3 — Controller Unit Tests (14 files in test/modules/controllers/)
Acceptance Criteria
Implementation Notes
- No new pub dependencies needed —
mockito and sqflite_ffi are already in pubspec.yaml
- Reference existing patterns in
test/api_service_test.dart (mock setup) and test/models/json/task_test.dart (model tests)
- All 14 controllers extend
GetxController — use Get.testMode = true per test group
- v3 net tests should mock
http.Client via @GenerateMocks([http.Client])
Labels
testing good first issue help wanted v3 controllers
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
Scope
Phase 1 — Test Infrastructure
test/v3/helpers.dart— shared setup for sqflite FFI, SharedPreferences mock, binding inittest/modules/controllers/helpers.dart— GetX test mode setup (Get.testMode = true,Get.reset())build_runnerto regenerate mocksPhase 2 — V3 Unit Tests (12 files)
Models (
test/v3/models/)test/v3/models/task_test.dart—TaskfromJson/toJson, null fields, edge casestest/v3/models/annotation_test.dart—Annotationserializationtest/v3/models/task_for_replica_test.dart—TaskForReplicamodelDatabase (
test/v3/db/)test/v3/db/task_database_test.dart— open, CRUD operations (sqflite FFI)test/v3/db/update_test.dart— migration/update logicNetwork (
test/v3/net/)test/v3/net/add_task_test.darttest/v3/net/complete_test.darttest/v3/net/delete_test.darttest/v3/net/fetch_test.darttest/v3/net/modify_test.darttest/v3/net/origin_test.dartChampion (
test/v3/champion/)test/v3/champion/replica_test.dart— sync logic with mocked DB and originPhase 3 — Controller Unit Tests (14 files in
test/modules/controllers/)home_controller_test.dart— filterTasks, updateTags, reactive state, searchsplash_controller_test.dart— init flow, navigation statetaskc_details_controller_test.dart— task init from args, field mutation, savesettings_controller_test.dart— language change, directory pick, themewidget_controller_test.dartlogs_controller_test.dartabout_controller_test.dartdetail_route_controller_test.dartmanage_task_server_controller_test.dart— server add/remove, connection testreports_controller_test.dartprofile_controller_test.dartpermission_controller_test.dartonboarding_controller_test.dartmanage_task_champion_creds_controller_test.dartAcceptance Criteria
flutter test test/v3/passes with all 12 v3 tests greenflutter test test/modules/controllers/passes with all 14 controller tests greenflutter testfull suite passes without regressiononInitstate, at least 2 state-mutating methods, and error/edge casesImplementation Notes
mockitoandsqflite_ffiare already inpubspec.yamltest/api_service_test.dart(mock setup) andtest/models/json/task_test.dart(model tests)GetxController— useGet.testMode = trueper test grouphttp.Clientvia@GenerateMocks([http.Client])Labels
testinggood first issuehelp wantedv3controllers