initial commit
Some checks failed
xiao_pet_tracker / semantic-pull-request (push) Has been cancelled
xiao_pet_tracker / build (push) Has been cancelled
xiao_pet_tracker / spell-check (push) Has been cancelled

This commit is contained in:
2025-02-23 20:50:34 +01:00
commit 2fe59fee0d
360 changed files with 14384 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
// import 'package:flutter_test/flutter_test.dart';
// import 'package:xiao_pet_tracker/app/app.dart';
// import 'package:xiao_pet_tracker/counter/counter.dart';
// void main() {
// group('App', () {
// testWidgets('renders CounterPage', (tester) async {
// await tester.pumpWidget(const App());
// expect(find.byType(CounterPage), findsOneWidget);
// });
// });
// }

View File

@@ -0,0 +1,26 @@
// import 'package:bloc_test/bloc_test.dart';
// import 'package:flutter_test/flutter_test.dart';
// import 'package:xiao_pet_tracker/counter/counter.dart';
// void main() {
// group('CounterCubit', () {
// test('initial state is 0', () {
// expect(CounterCubit().state, equals(0));
// });
// blocTest<CounterCubit, int>(
// 'emits [1] when increment is called',
// build: CounterCubit.new,
// act: (cubit) => cubit.increment(),
// expect: () => [equals(1)],
// );
// blocTest<CounterCubit, int>(
// 'emits [-1] when decrement is called',
// build: CounterCubit.new,
// act: (cubit) => cubit.decrement(),
// expect: () => [equals(-1)],
// );
// });
// }

View File

@@ -0,0 +1,68 @@
// import 'package:bloc_test/bloc_test.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_bloc/flutter_bloc.dart';
// import 'package:flutter_test/flutter_test.dart';
// import 'package:mocktail/mocktail.dart';
// import 'package:xiao_pet_tracker/counter/counter.dart';
// import '../../helpers/helpers.dart';
// class MockCounterCubit extends MockCubit<int> implements CounterCubit {}
// void main() {
// group('CounterPage', () {
// testWidgets('renders CounterView', (tester) async {
// await tester.pumpApp(const CounterPage());
// expect(find.byType(CounterView), findsOneWidget);
// });
// });
// group('CounterView', () {
// late CounterCubit counterCubit;
// setUp(() {
// counterCubit = MockCounterCubit();
// });
// testWidgets('renders current count', (tester) async {
// const state = 42;
// when(() => counterCubit.state).thenReturn(state);
// await tester.pumpApp(
// BlocProvider.value(
// value: counterCubit,
// child: const CounterView(),
// ),
// );
// expect(find.text('$state'), findsOneWidget);
// });
// testWidgets('calls increment when increment button is tapped',
// (tester) async {
// when(() => counterCubit.state).thenReturn(0);
// when(() => counterCubit.increment()).thenReturn(null);
// await tester.pumpApp(
// BlocProvider.value(
// value: counterCubit,
// child: const CounterView(),
// ),
// );
// await tester.tap(find.byIcon(Icons.add));
// verify(() => counterCubit.increment()).called(1);
// });
// testWidgets('calls decrement when decrement button is tapped',
// (tester) async {
// when(() => counterCubit.state).thenReturn(0);
// when(() => counterCubit.decrement()).thenReturn(null);
// await tester.pumpApp(
// BlocProvider.value(
// value: counterCubit,
// child: const CounterView(),
// ),
// );
// await tester.tap(find.byIcon(Icons.remove));
// verify(() => counterCubit.decrement()).called(1);
// });
// });
// }

View File

@@ -0,0 +1 @@
// export 'pump_app.dart';

View File

@@ -0,0 +1,15 @@
// import 'package:flutter/material.dart';
// import 'package:flutter_test/flutter_test.dart';
// import 'package:xiao_pet_tracker/l10n/l10n.dart';
// extension PumpApp on WidgetTester {
// Future<void> pumpApp(Widget widget) {
// return pumpWidget(
// MaterialApp(
// localizationsDelegates: AppLocalizations.localizationsDelegates,
// supportedLocales: AppLocalizations.supportedLocales,
// home: widget,
// ),
// );
// }
// }