diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml new file mode 100644 index 0000000..fed8709 --- /dev/null +++ b/.github/workflows/dart.yml @@ -0,0 +1,30 @@ +name: Execute Tests on PR +on: + push: + pull_request: + branches: [main] + +jobs: + + runUnitTest: + name: Execute Unit/Widget tests + + runs-on: macos-latest + steps: + + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Setup Flutter SDK + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + + - name: Lint + run: dart format --output=none --set-exit-if-changed . + + - name: Pub Upgrade + run: flutter pub upgrade + + # - name: Run Unit Tests / Widget Tests + # run: flutter test diff --git a/lib/Provider/todo_schema.dart b/lib/Provider/todo_schema.dart index 523ab41..73b0bb1 100644 --- a/lib/Provider/todo_schema.dart +++ b/lib/Provider/todo_schema.dart @@ -1,4 +1,7 @@ -class Todo { +import 'package:equatable/equatable.dart'; + +// ignore: must_be_immutable +class Todo extends Equatable { String todo; String description; String id; @@ -20,4 +23,7 @@ class Todo { id: m['_id'], isCompleted: m['is_completed']); } + + @override + List get props => [id]; } diff --git a/lib/button/done_list_page_buttons/done_delete.dart b/lib/button/done_list_page_buttons/done_delete.dart index b1dfaf1..6cc4a6e 100644 --- a/lib/button/done_list_page_buttons/done_delete.dart +++ b/lib/button/done_list_page_buttons/done_delete.dart @@ -16,9 +16,7 @@ class DoneDeleteButton extends ConsumerWidget { return IconButton.filled( color: Theme.of(context).cardColor, onPressed: () { - ref - .read(futureTodoListProvider.notifier) - .markedDelete(itr: todo); + ref.read(futureTodoListProvider.notifier).markedDelete(itr: todo); }, icon: const Icon(Icons.delete), ); diff --git a/lib/screens/todo_list_screen/no_to_list.dart b/lib/screens/todo_list_screen/no_to_list.dart index 3f7b8bd..01befb4 100644 --- a/lib/screens/todo_list_screen/no_to_list.dart +++ b/lib/screens/todo_list_screen/no_to_list.dart @@ -23,4 +23,4 @@ class _NoTodoListState extends State { ], ); } -} \ No newline at end of file +} diff --git a/pubspec.yaml b/pubspec.yaml index 6a17406..ad9bf72 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -52,6 +52,7 @@ dependencies: flutter_cache_manager: ^3.3.1 path_provider: ^2.1.1 http: ^1.1.0 + equatable: ^2.0.5 dev_dependencies: @@ -66,6 +67,8 @@ dev_dependencies: flutter_lints: ^3.0.1 riverpod_generator: ^2.3.1 riverpod_lint: ^2.0.3 + integration_test: + sdk: flutter # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec