Testing patterns
Skill RadKod/claude-agents-kit/flutter/.claude/skills/testing-patterns
Flutter test pattern'leri. ViewModel test, widget test, repository mock. Test yazarken kullan.From its SKILL.md
npx -y skills add RadKod/claude-agents-kit --skill testing-patternsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.0 KB, 441 tokens by cl100k_base, as published. Nobody here has run it
ViewModel Test (Riverpod)
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:riverpod/riverpod.dart';
class MockAuthRepository extends Mock implements AuthRepository {}
void main() {
late MockAuthRepository mockRepo;
late ProviderContainer container;
setUp(() {
mockRepo = MockAuthRepository();
container = ProviderContainer(
overrides: [authRepositoryProvider.overrideWithValue(mockRepo)],
);
});
tearDown(() => container.dispose());
test('login basarili olunca user doner', () async {
final user = UserModel(id: '1', name: 'Test', email: '[email protected]');
when(() => mockRepo.login(any(), any())).thenAnswer((_) async => user);
final vm = container.read(authViewModelProvider.notifier);
await vm.login('[email protected]', '123456');
final state = container.read(authViewModelProvider);
expect(state.value, user);
});
test('login basarisiz olunca error state doner', () async {
when(() => mockRepo.login(any(), any())).thenThrow(Exception('Hata'));
final vm = container.read(authViewModelProvider.notifier);
await vm.login('[email protected]', 'wrong');
final state = container.read(authViewModelProvider);
expect(state.hasError, true);
});
}
Widget Test
testWidgets('login butonu tiklayinca form submit eder', (tester) async {
await tester.pumpWidget(
ProviderScope(
overrides: [authViewModelProvider.overrideWith(() => FakeAuthVM())],
child: const MaterialApp(home: LoginScreen()),
),
);
await tester.enterText(find.byType(TextField).first, '[email protected]');
await tester.enterText(find.byType(TextField).last, '123456');
await tester.tap(find.text('Giris Yap'));
await tester.pumpAndSettle();
// Assert
expect(find.byType(CircularProgressIndicator), findsOneWidget);
});
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.