diff --git a/.github/workflow/flutter_analyze.yaml b/.github/workflows/flutter_analyze.yaml similarity index 55% rename from .github/workflow/flutter_analyze.yaml rename to .github/workflows/flutter_analyze.yaml index 5c9f93a..2e38ce4 100644 --- a/.github/workflow/flutter_analyze.yaml +++ b/.github/workflows/flutter_analyze.yaml @@ -1,3 +1,10 @@ +# +# Copyright (c) 2021 tokku5552 +# +# This software is released under the MIT License. +# https://opensource.org/licenses/mit-license.php +# +# name: Flutter_Analyzer on: @@ -5,18 +12,19 @@ on: types: [opened, synchronize] push: branches: - - master + - main + - develop jobs: flutter_analyze: runs-on: ubuntu-latest - timeout-minutes: 1 + timeout-minutes: 10 steps: - uses: actions/checkout@v2 with: fetch-depth: 1 - uses: subosito/flutter-action@v1 with: - channel: 'beta' + channel: 'stable' - run: flutter pub get - run: flutter analyze \ No newline at end of file diff --git a/.github/workflows/flutter_test.yaml b/.github/workflows/flutter_test.yaml new file mode 100644 index 0000000..dfd29ba --- /dev/null +++ b/.github/workflows/flutter_test.yaml @@ -0,0 +1,34 @@ +# +# Copyright (c) 2021 tokku5552 +# +# This software is released under the MIT License. +# https://opensource.org/licenses/mit-license.php +# +# +name: Flutter_Test + +on: + pull_request: + types: [opened, synchronize] + push: + branches: + - main + - develop + +jobs: + flutter_test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: subosito/flutter-action@v1 + with: + channel: 'stable' + - run: flutter pub get + - run: flutter test --no-test-assets --coverage --coverage-path=~/coverage/lcov.info + - uses: codecov/codecov-action@v1 + with: + token: ${{secrets.CODECOV_TOKEN}} + file: ~/coverage/lcov.info diff --git a/analysis_options.yaml b/analysis_options.yaml index c6d040c..d4fcc1a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,2 +1 @@ -# https://pub.dev/packages/pedantic_mono -include: package:pedantic_mono/analysis_options.yaml \ No newline at end of file +include: package:pedantic/analysis_options.yaml \ No newline at end of file diff --git a/lib/presentation/todo_list/todo_list_page.dart b/lib/presentation/todo_list/todo_list_page.dart index 6645472..c03f9ca 100644 --- a/lib/presentation/todo_list/todo_list_page.dart +++ b/lib/presentation/todo_list/todo_list_page.dart @@ -34,7 +34,7 @@ class TodoListPage extends StatelessWidget { return PopupMenuButton( initialValue: 'model.viewCompletedItems', onSelected: (String s) async { - model.changeViewCompletedItems(s); + await model.changeViewCompletedItems(s); await model.getTodoList(); }, itemBuilder: (BuildContext context) { @@ -133,6 +133,6 @@ class TodoListPage extends StatelessWidget { fullscreenDialog: true, ), ); - model.getTodoList(); + await model.getTodoList(); } } diff --git a/pubspec.lock b/pubspec.lock index fe9c1ed..96d2a6e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -142,13 +142,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.4+3" - pedantic_mono: + pedantic: dependency: "direct dev" description: - name: pedantic_mono + name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.10.0+3" + version: "1.9.2" platform: dependency: transitive description: @@ -176,7 +176,7 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "4.3.2+2" + version: "4.3.3" shared_preferences: dependency: "direct main" description: @@ -218,7 +218,7 @@ packages: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+3" + version: "0.0.2+3" sky_engine: dependency: transitive description: flutter @@ -237,14 +237,14 @@ packages: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "1.3.2+1" + version: "1.3.2+3" sqflite_common: dependency: transitive description: name: sqflite_common url: "https://pub.dartlang.org" source: hosted - version: "1.0.2+1" + version: "1.0.3+1" stack_trace: dependency: transitive description: @@ -307,7 +307,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.4" + version: "1.7.4+1" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index d25e159..f60a030 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,3 +1,10 @@ +# +# Copyright (c) 2021 tokku5552 +# +# This software is released under the MIT License. +# https://opensource.org/licenses/mit-license.php +# +# name: todo_app_sample_flutter description: A new Flutter application. @@ -21,7 +28,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - pedantic_mono: any + pedantic: ^1.9.2 flutter: uses-material-design: true diff --git a/test/todo_item_detail_model_test.dart b/test/todo_item_detail_model_test.dart index 656bebd..72e344a 100644 --- a/test/todo_item_detail_model_test.dart +++ b/test/todo_item_detail_model_test.dart @@ -66,7 +66,7 @@ void main() { ); // repository.create( // '変更前', '変更前', false, DateTime.now().subtract(Duration(days: 1))); - repository.create( + await repository.create( title: '変更前', body: '変更前', isDone: false, diff --git a/test/todo_item_test.dart b/test/todo_item_test.dart index 7b79da5..dde2b2e 100644 --- a/test/todo_item_test.dart +++ b/test/todo_item_test.dart @@ -9,8 +9,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:todo_app_sample_flutter/domain/todo_item.dart'; void main() { - group("TodoItemのゲッターのテスト", () { - final TodoItem todoItem = TodoItem( + group('TodoItemのゲッターのテスト', () { + final todoItem = TodoItem( id: 0, title: 'title', body: 'body', @@ -24,11 +24,11 @@ void main() { }); test('titleのテスト', () async { - expect(todoItem.getTitle, "title"); + expect(todoItem.getTitle, 'title'); }); test('bodyのテスト', () async { - expect(todoItem.getBody, "body"); + expect(todoItem.getBody, 'body'); }); test('createdAtのテスト', () async { @@ -44,8 +44,8 @@ void main() { }); }); - group("toMapのテスト", () { - final TodoItem todoItem = TodoItem( + group('toMapのテスト', () { + final todoItem = TodoItem( id: 0, title: 'title', body: 'body', @@ -77,7 +77,7 @@ void main() { }); }); - group("fromMapのテスト", () { + group('fromMapのテスト', () { final json = { 'id': 0, 'title': 'title', @@ -107,8 +107,8 @@ void main() { }); }); - group("toStringのテスト", () { - final TodoItem todoItem = TodoItem( + group('toStringのテスト', () { + final todoItem = TodoItem( id: 0, title: 'title', body: 'body', diff --git a/test/todo_list_model_test.dart b/test/todo_list_model_test.dart index 829bb8e..8183bb7 100644 --- a/test/todo_list_model_test.dart +++ b/test/todo_list_model_test.dart @@ -52,13 +52,12 @@ void main() { todoItemRepository.clear(); for (final todoItem in data) { - todoItemRepository - ..incrementId() - ..create( - title: todoItem.title, - body: todoItem.body, - isDone: todoItem.isDone, - now: now); + todoItemRepository.incrementId(); + await todoItemRepository.create( + title: todoItem.title, + body: todoItem.body, + isDone: todoItem.isDone, + now: now); } model.viewCompletedItems = true; @@ -89,13 +88,12 @@ void main() { // 事前準備 todoItemRepository.clear(); for (final todoItem in data) { - todoItemRepository - ..incrementId() - ..create( - title: todoItem.title, - body: todoItem.body, - isDone: todoItem.isDone, - now: now); + todoItemRepository.incrementId(); + await todoItemRepository.create( + title: todoItem.title, + body: todoItem.body, + isDone: todoItem.isDone, + now: now); } // メソッド実行 @@ -112,13 +110,12 @@ void main() { // 事前準備 todoItemRepository.clear(); for (final todoItem in data) { - todoItemRepository - ..incrementId() - ..create( - title: todoItem.title, - body: todoItem.body, - isDone: todoItem.isDone, - now: now); + todoItemRepository.incrementId(); + await todoItemRepository.create( + title: todoItem.title, + body: todoItem.body, + isDone: todoItem.isDone, + now: now); } // メソッド実行 @@ -165,10 +162,9 @@ void main() { test('正常系:keyがある時', () async { // 事前準備 - storageRepository - ..clear() - ..savePersistenceStorage( - viewCompletedItemsKey, viewCompletedItemsTrueString); + storageRepository.clear(); + await storageRepository.savePersistenceStorage( + viewCompletedItemsKey, viewCompletedItemsTrueString); // メソッド実行 await model.loadViewCompletedItems(); diff --git a/test/widget_test.dart b/test/widget_test.dart index 7b4ba39..fd040a3 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -5,9 +5,7 @@ // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. -import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:todo_app_sample_flutter/presentation/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async {