원클릭으로
statera-tests
Patterns and guidelines for writing widget tests. Use these instructions when asked to create tests for a Flutter widget.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Patterns and guidelines for writing widget tests. Use these instructions when asked to create tests for a Flutter widget.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | statera-tests |
| description | Patterns and guidelines for writing widget tests. Use these instructions when asked to create tests for a Flutter widget. |
use customPump() from test/helpers.dart to pump a widget under test.
pass any providers (including Cubits/Blocs) via extraProviders.
stub/mock only the required dependencies of the widget under test. The test should fail if any mock is removed.
for BlocListener-driven widgets, stub state and/or stream depending on what is being used in the widget:
when(cubit.state).thenReturn(SomeState());
when(cubit.stream).thenAnswer((_) => Stream.value(SomeState()));
mocks are generated by Mockito — each service class has @GenerateNiceMocks([MockSpec<T>()]) on it and a corresponding .mocks.dart file. After adding a new mock annotation, regenerate with dart run build_runner build.
BLoC-unit tests use the bloc_test package (blocTest<>, seed:, act:, expect:).
always extract a helper method that pumps the widget under test, it should be named pump[WidgetName].
place helper methods AFTER all the tests in the test file.