← ClaudeAtlas

write-testslisted

Write unit and widget tests — where each layer is tested, mocktail fakes at the right seam, MobX observable assertions, widget tests for the loading/error/empty/content branches, and the "can this fail if the real code is broken?" check. Use whenever adding or changing a store, state, use case, service or page.
NarekManukyan/flutter-mobx-kit · ★ 0 · Testing & QA · score 70
Install: claude install-skill NarekManukyan/flutter-mobx-kit
# Write unit and widget tests Governed by [ADR-0015](../../../docs/adr/0015-mandatory-test-coverage-and-qa-gate.md). Unit and widget tests are two of the three mandatory tiers; the third is [`write-maestro-flow`](../write-maestro-flow/SKILL.md). ## Where tests live `test/` mirrors `lib/`. ``` test/ features/{feature}/ mobx/{feature}_store_test.dart view/{feature}_page_state_test.dart view/{feature}_page_test.dart widget test use_cases/{name}_use_case_test.dart core/… helpers/ shared fakes + pump helpers ``` ## Test the seam below the unit Each layer has exactly one collaborator type to fake ([ADR-0001](../../../docs/adr/0001-layered-architecture.md)): | Testing | Fake | Never fake | |---|---|---| | Store | `DioService` (or the provider it exposes) | the store's own observables | | Page state | the store, `AppNavigator`, use cases | the state under test | | Use case | `DioService` / services / `AppNavigator` | — | | Page (widget) | the page state | the widget tree | **Prefer real objects > fake > mock.** A real `TodoDto` beats a mocked one. A hand-written fake store with a settable field beats a mocked store with five `when(...)` stubs. ## Conventions - Always `group()`, named after the class under test. - Test names begin with `should`: `test('should set error when the request fails', …)`. - Arrange-Act-Assert, with a blank line between the three. - One behaviour per test. A test asserting four unrelate