From fd7afb86dc56e104a7decaf669efc03a39cdf5a2 Mon Sep 17 00:00:00 2001 From: 4seer <59827284+4seer@users.noreply.github.com> Date: Tue, 10 Mar 2020 15:25:41 +0300 Subject: [PATCH 01/15] Update README.md --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 9b652eae..deeb8e94 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,30 @@ Functionality description and discussion [E-commerce App Mobile App Local Database Structure](https://medium.com/@openflutterproject/open-flutter-project-e-commerce-app-local-database-4744b61264c7) +## Flutter Version +You may need to update flutter to dev or beta for the most recent updates to work. Use following commands to upgrade flutter: + +``` +flutter channel dev +flutter upgrade +``` +or + +``` +flutter channel beta +flutter upgrade +``` + +## Tests +To run tests use command below: + +``` +flutter run -t test/test.dart +``` + + +## IDE settings You need to update the configuration of your IDE to tell the location of the entry point. The example for VS Code is below: From 307805b13d06a5fb3bad56e325a0eb73ccdfaf0c Mon Sep 17 00:00:00 2001 From: 4seer <59827284+4seer@users.noreply.github.com> Date: Tue, 10 Mar 2020 15:42:28 +0300 Subject: [PATCH 02/15] Create dart.yml --- .github/workflows/dart.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/dart.yml diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml new file mode 100644 index 00000000..11e18c7b --- /dev/null +++ b/.github/workflows/dart.yml @@ -0,0 +1,22 @@ +name: Dart CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + container: + image: google/dart:latest + + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: pub get + - name: Run tests + run: pub run test From a78d0b6b73080cd3455b0849244eb9ab9ad7884f Mon Sep 17 00:00:00 2001 From: 4seer <59827284+4seer@users.noreply.github.com> Date: Tue, 10 Mar 2020 15:44:50 +0300 Subject: [PATCH 03/15] Update dart.yml --- .github/workflows/dart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 11e18c7b..03cd6dd1 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -17,6 +17,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install dependencies - run: pub get + run: flutter pub get - name: Run tests run: pub run test From 8e68a9ae9038461400e8e7f4bf617e7c95f36b23 Mon Sep 17 00:00:00 2001 From: 4seer <59827284+4seer@users.noreply.github.com> Date: Tue, 10 Mar 2020 15:46:46 +0300 Subject: [PATCH 04/15] Update dart.yml --- .github/workflows/dart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 03cd6dd1..11e18c7b 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -17,6 +17,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install dependencies - run: flutter pub get + run: pub get - name: Run tests run: pub run test From 36bd4b91e9be723b2649a557912d28ad1601f996 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 10 Mar 2020 15:47:48 +0300 Subject: [PATCH 05/15] Pedantic package for tests --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 84d38aea..b5bbebd2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -40,7 +40,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter -# pedantic: 1.8.0+1 + pedantic: 1.8.0+1 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From 9df884490b093b093c41b7d34d4cb56be616c9d8 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 10 Mar 2020 15:51:39 +0300 Subject: [PATCH 06/15] Pedantic package for tests --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index b5bbebd2..5745f2bb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -40,7 +40,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - pedantic: 1.8.0+1 + pedantic: any # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From 38d78033e115fe7581ad617b0b77c447d5635092 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 10 Mar 2020 15:58:39 +0300 Subject: [PATCH 07/15] Pedantic package for tests --- .github/workflows/dart.yml | 4 ++-- pubspec.yaml | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 11e18c7b..a6a494f0 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -2,9 +2,9 @@ name: Dart CI on: push: - branches: [ master ] + branches: [ dev_cicd_tests ] pull_request: - branches: [ master ] + branches: [ dev_cicd_tests ] jobs: build: diff --git a/pubspec.yaml b/pubspec.yaml index 5745f2bb..61b3192e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,14 +33,16 @@ dependencies: bubble_tab_indicator: any dartz: ^0.8.9 rxdart: ^0.23.1 - pedantic: ^1.9.0 sqflite: path: dev_dependencies: flutter_test: sdk: flutter - pedantic: any + pedantic: 1.8.0+1 + +dependency_overrides: + pedantic: ^1.9.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From a2c4ba90cdb7eb7510ccfc1e125ec9c90e56e3a3 Mon Sep 17 00:00:00 2001 From: 4seer <59827284+4seer@users.noreply.github.com> Date: Tue, 10 Mar 2020 16:12:06 +0300 Subject: [PATCH 08/15] Update dart.yml --- .github/workflows/dart.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index a6a494f0..cef3ab24 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -16,7 +16,13 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v1 + with: + flutter-version: '1.12.14' + channel: 'dev' - name: Install dependencies - run: pub get - - name: Run tests - run: pub run test + run: flutter pub get + - name: Static analysis + run: flutter analyze + - name: Running tests + run: flutter test --coverage From 02d41b823380cadba4acaade223917caa260b215 Mon Sep 17 00:00:00 2001 From: 4seer <59827284+4seer@users.noreply.github.com> Date: Tue, 10 Mar 2020 16:20:49 +0300 Subject: [PATCH 09/15] Update dart.yml --- .github/workflows/dart.yml | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index cef3ab24..2dab2781 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -7,22 +7,23 @@ on: branches: [ dev_cicd_tests ] jobs: - build: - - runs-on: ubuntu-latest - - container: - image: google/dart:latest - + + test: + #The type of machine to run the job on. [windows,macos, ubuntu , self-hosted] + runs-on: macos-latest + #sequence of tasks called steps: - - uses: actions/checkout@v2 - - uses: subosito/flutter-action@v1 - with: - flutter-version: '1.12.14' - channel: 'dev' - - name: Install dependencies - run: flutter pub get - - name: Static analysis - run: flutter analyze - - name: Running tests - run: flutter test --coverage + # The branch or tag ref that triggered the workflow will be checked out. + # https://github.com/actions/checkout + - uses: actions/checkout@v1 + # Setup a flutter environment. + # https://github.com/marketplace/actions/flutter-action + - uses: subosito/flutter-action@v1 + with: + flutter-version: '1.12.14' + channel: 'dev' + - run: flutter pub get + - name: Static analysis + run: flutter analyze + - name: Running tests + run: flutter test --coverage From 8b70832e288b0d1f83708f4de3b602d9a0cdb4ec Mon Sep 17 00:00:00 2001 From: 4seer <59827284+4seer@users.noreply.github.com> Date: Tue, 10 Mar 2020 16:25:49 +0300 Subject: [PATCH 10/15] Update dart.yml --- .github/workflows/dart.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 2dab2781..125e1533 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -20,10 +20,10 @@ jobs: # https://github.com/marketplace/actions/flutter-action - uses: subosito/flutter-action@v1 with: - flutter-version: '1.12.14' + flutter-version: '1.15.18' channel: 'dev' - run: flutter pub get - - name: Static analysis - run: flutter analyze + #- name: Static analysis + # run: flutter analyze - name: Running tests run: flutter test --coverage From eeaf2f4ff3af7546a2163bc8719358505a40198b Mon Sep 17 00:00:00 2001 From: 4seer <59827284+4seer@users.noreply.github.com> Date: Tue, 10 Mar 2020 16:43:21 +0300 Subject: [PATCH 11/15] Update dart.yml --- .github/workflows/dart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 125e1533..9060fe97 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -26,4 +26,4 @@ jobs: #- name: Static analysis # run: flutter analyze - name: Running tests - run: flutter test --coverage + run: flutter run -t test/tests.dart From c93d0420af0170f3eebd18f84d707eb0e5a7e9d3 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 10 Mar 2020 17:06:40 +0300 Subject: [PATCH 12/15] Static analysis update for workflows. --- .github/workflows/dart.yml | 9 +++++---- analysis_options.yaml | 5 +++++ lib/domain/entities/entity.dart | 7 +++++-- test/data/local/all_tests.dart | 2 +- test/data/local/cart/product_cart_data_source_test.dart | 4 ++-- .../local/delivery/delivery_method_data_source_test.dart | 4 ++-- .../local/hashtag/category_hashtag_data_source_test.dart | 4 ++-- test/data/local/hashtag/hashtag_data_source_test.dart | 4 ++-- .../local/hashtag/product_hashtag_data_source_test.dart | 4 ++-- .../data/local/order/order_product_data_source_test.dart | 4 ++-- .../order/order_product_parameter_data_source_test.dart | 4 ++-- test/data/local/order/user_order_data_source_test.dart | 4 ++-- .../product/product2parameter_data_source_test.dart | 4 ++-- .../local/product/product_category_data_source_test.dart | 4 ++-- test/data/local/product/product_data_source_test.dart | 4 ++-- .../local/product/product_image_data_source_test.dart | 4 ++-- .../product/product_parameter_data_source_test.dart | 4 ++-- .../product_parameter_variant_data_source_test.dart | 4 ++-- .../local/product/product_review_data_source_test.dart | 4 ++-- .../product/product_review_photo_data_source_test.dart | 4 ++-- test/data/local/promo/promo_code_data_source_test.dart | 4 ++-- .../local/user/shipping_address_data_source_test.dart | 4 ++-- test/data/local/user/user_data_source_test.dart | 6 +++--- test/tests.dart | 2 +- 24 files changed, 56 insertions(+), 47 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 9060fe97..664337ae 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -23,7 +23,8 @@ jobs: flutter-version: '1.15.18' channel: 'dev' - run: flutter pub get - #- name: Static analysis - # run: flutter analyze - - name: Running tests - run: flutter run -t test/tests.dart + - name: Static analysis + run: flutter analyze + # - name: Running tests + # We can run SQLite tests only on real device + # run: flutter run -t test/tests.dart diff --git a/analysis_options.yaml b/analysis_options.yaml index 108d1058..89cb6f66 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1 +1,6 @@ include: package:pedantic/analysis_options.yaml + +analyzer: + errors: + todo: ignore + omit_local_variable_types: ignore diff --git a/lib/domain/entities/entity.dart b/lib/domain/entities/entity.dart index e4d29b6d..8e8e9456 100644 --- a/lib/domain/entities/entity.dart +++ b/lib/domain/entities/entity.dart @@ -7,8 +7,11 @@ abstract class Entity extends Equatable{ Entity(this.id); - @override - Map toMap(); + Map toMap() { + return { + 'id': id + }; + } @override List get props => []; diff --git a/test/data/local/all_tests.dart b/test/data/local/all_tests.dart index c3c74399..bcf036b8 100644 --- a/test/data/local/all_tests.dart +++ b/test/data/local/all_tests.dart @@ -32,7 +32,7 @@ import 'user/shipping_address_data_source_test.dart' as shipping_address_data_source_test; import 'user/user_data_source_test.dart' as user_data_source_test; -main(List args) { +void main(List args) { // run tests on all data sources (tables) delivery_method_data_source_test.main(); category_hashtag_data_source_test.main(); diff --git a/test/data/local/cart/product_cart_data_source_test.dart b/test/data/local/cart/product_cart_data_source_test.dart index edee6e5c..73bb3281 100644 --- a/test/data/local/cart/product_cart_data_source_test.dart +++ b/test/data/local/cart/product_cart_data_source_test.dart @@ -53,7 +53,7 @@ void main() { await dataSource.deleteAll(); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: delete a record in productcart table', () async { @@ -65,7 +65,7 @@ void main() { await dataSource.delete(1); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: get all records in productcart table', () async { diff --git a/test/data/local/delivery/delivery_method_data_source_test.dart b/test/data/local/delivery/delivery_method_data_source_test.dart index 94cf866c..24d1ad08 100644 --- a/test/data/local/delivery/delivery_method_data_source_test.dart +++ b/test/data/local/delivery/delivery_method_data_source_test.dart @@ -50,7 +50,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in DeliveryMethod table', () async { @@ -62,7 +62,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in DeliveryMethod table', () async { diff --git a/test/data/local/hashtag/category_hashtag_data_source_test.dart b/test/data/local/hashtag/category_hashtag_data_source_test.dart index 1c7c0b1c..e68ee729 100644 --- a/test/data/local/hashtag/category_hashtag_data_source_test.dart +++ b/test/data/local/hashtag/category_hashtag_data_source_test.dart @@ -50,7 +50,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in CategoryHashTag table', () async { @@ -62,7 +62,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in CategoryHashTag table', () async { diff --git a/test/data/local/hashtag/hashtag_data_source_test.dart b/test/data/local/hashtag/hashtag_data_source_test.dart index 654a3df1..f8ec1b06 100644 --- a/test/data/local/hashtag/hashtag_data_source_test.dart +++ b/test/data/local/hashtag/hashtag_data_source_test.dart @@ -62,7 +62,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in HashTag table', () async { @@ -76,7 +76,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in HashTag table', () async { diff --git a/test/data/local/hashtag/product_hashtag_data_source_test.dart b/test/data/local/hashtag/product_hashtag_data_source_test.dart index 8f500f0e..8b565ad2 100644 --- a/test/data/local/hashtag/product_hashtag_data_source_test.dart +++ b/test/data/local/hashtag/product_hashtag_data_source_test.dart @@ -50,7 +50,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in ProductHashTag table', () async { @@ -62,7 +62,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in ProductHashTag table', () async { diff --git a/test/data/local/order/order_product_data_source_test.dart b/test/data/local/order/order_product_data_source_test.dart index e0f86789..f9d80d62 100644 --- a/test/data/local/order/order_product_data_source_test.dart +++ b/test/data/local/order/order_product_data_source_test.dart @@ -86,7 +86,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in OrderProduct table', () async { @@ -104,7 +104,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in OrderProduct table', () async { diff --git a/test/data/local/order/order_product_parameter_data_source_test.dart b/test/data/local/order/order_product_parameter_data_source_test.dart index 34b43c1b..30626e52 100644 --- a/test/data/local/order/order_product_parameter_data_source_test.dart +++ b/test/data/local/order/order_product_parameter_data_source_test.dart @@ -55,7 +55,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in OrderProductParameter table', () async { @@ -67,7 +67,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in OrderProductParameter table', () async { diff --git a/test/data/local/order/user_order_data_source_test.dart b/test/data/local/order/user_order_data_source_test.dart index ce1e7884..a1e692f5 100644 --- a/test/data/local/order/user_order_data_source_test.dart +++ b/test/data/local/order/user_order_data_source_test.dart @@ -116,7 +116,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in UserOrder table', () async { @@ -139,7 +139,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in UserOrder table', () async { diff --git a/test/data/local/product/product2parameter_data_source_test.dart b/test/data/local/product/product2parameter_data_source_test.dart index e27b1926..a34969d6 100644 --- a/test/data/local/product/product2parameter_data_source_test.dart +++ b/test/data/local/product/product2parameter_data_source_test.dart @@ -69,7 +69,7 @@ void main() { await dataSource.deleteAll(); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: delete a record in product2parameter table', () async { @@ -84,7 +84,7 @@ void main() { await dataSource.delete(1); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: get all records in product2parameter table', () async { diff --git a/test/data/local/product/product_category_data_source_test.dart b/test/data/local/product/product_category_data_source_test.dart index bf01abc9..70c5b162 100644 --- a/test/data/local/product/product_category_data_source_test.dart +++ b/test/data/local/product/product_category_data_source_test.dart @@ -80,7 +80,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in ProductCategory table', () async { @@ -97,7 +97,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in ProductCategory table', () async { diff --git a/test/data/local/product/product_data_source_test.dart b/test/data/local/product/product_data_source_test.dart index 6a423f31..a2141409 100644 --- a/test/data/local/product/product_data_source_test.dart +++ b/test/data/local/product/product_data_source_test.dart @@ -147,7 +147,7 @@ void main() { await productDataSource.deleteAll(); List allProducts = await productDataSource.all(); - expect(allProducts.length == 0, true); + expect(allProducts.isEmpty, true); }); test('test: delete a product', () async { @@ -175,7 +175,7 @@ void main() { await productDataSource.delete(1); List allProducts = await productDataSource.all(); - expect(allProducts.length == 0, true); + expect(allProducts.isEmpty, true); }); test('test: get all products', () async { diff --git a/test/data/local/product/product_image_data_source_test.dart b/test/data/local/product/product_image_data_source_test.dart index 9c97b80b..e63453e5 100644 --- a/test/data/local/product/product_image_data_source_test.dart +++ b/test/data/local/product/product_image_data_source_test.dart @@ -74,7 +74,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in ProductImage table', () async { @@ -90,7 +90,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in ProductImage table', () async { diff --git a/test/data/local/product/product_parameter_data_source_test.dart b/test/data/local/product/product_parameter_data_source_test.dart index ee7657b0..90d4724c 100644 --- a/test/data/local/product/product_parameter_data_source_test.dart +++ b/test/data/local/product/product_parameter_data_source_test.dart @@ -63,7 +63,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in ProductParameter table', () async { @@ -77,7 +77,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in ProductParameter table', () async { diff --git a/test/data/local/product/product_parameter_variant_data_source_test.dart b/test/data/local/product/product_parameter_variant_data_source_test.dart index d8c8c287..a146d01a 100644 --- a/test/data/local/product/product_parameter_variant_data_source_test.dart +++ b/test/data/local/product/product_parameter_variant_data_source_test.dart @@ -79,7 +79,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in ProductParameterVariant table', () async { @@ -95,7 +95,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in ProductParameterVariant table', () async { diff --git a/test/data/local/product/product_review_data_source_test.dart b/test/data/local/product/product_review_data_source_test.dart index ae7c5e0e..3e4dd1f4 100644 --- a/test/data/local/product/product_review_data_source_test.dart +++ b/test/data/local/product/product_review_data_source_test.dart @@ -98,7 +98,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in ProductReview table', () async { @@ -118,7 +118,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in ProductReview table', () async { diff --git a/test/data/local/product/product_review_photo_data_source_test.dart b/test/data/local/product/product_review_photo_data_source_test.dart index c993cf7b..632f6405 100644 --- a/test/data/local/product/product_review_photo_data_source_test.dart +++ b/test/data/local/product/product_review_photo_data_source_test.dart @@ -69,7 +69,7 @@ void main() { await dataSource.deleteAll(); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: delete a record in ProductReviewPhoto table', () async { @@ -84,7 +84,7 @@ void main() { await dataSource.delete(1); List allRecords = await dataSource.all(); - expect(allRecords.length == 0, true); + expect(allRecords.isEmpty, true); }); test('test: get all records in ProductReviewPhoto table', () async { diff --git a/test/data/local/promo/promo_code_data_source_test.dart b/test/data/local/promo/promo_code_data_source_test.dart index 4f9cde29..c0e7acae 100644 --- a/test/data/local/promo/promo_code_data_source_test.dart +++ b/test/data/local/promo/promo_code_data_source_test.dart @@ -86,7 +86,7 @@ void main() { await dataSource.deleteAll(); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: delete a record in promocode table', () async { @@ -104,7 +104,7 @@ void main() { await dataSource.delete(1); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: get all records in promocode table', () async { diff --git a/test/data/local/user/shipping_address_data_source_test.dart b/test/data/local/user/shipping_address_data_source_test.dart index eea5c5e5..f705385a 100644 --- a/test/data/local/user/shipping_address_data_source_test.dart +++ b/test/data/local/user/shipping_address_data_source_test.dart @@ -86,7 +86,7 @@ void main() { await dataSource.deleteAll(); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: delete a record in shippingaddress table', () async { @@ -103,7 +103,7 @@ void main() { await dataSource.delete(1); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: get all records in shippingaddress table', () async { diff --git a/test/data/local/user/user_data_source_test.dart b/test/data/local/user/user_data_source_test.dart index c15ee738..588afe4f 100644 --- a/test/data/local/user/user_data_source_test.dart +++ b/test/data/local/user/user_data_source_test.dart @@ -59,7 +59,7 @@ void main() { await dataSource.update(dataToUpdate); - UserEntity updatedData = await dataSource.get(dataToUpdate.id); + var updatedData = await dataSource.get(dataToUpdate.id); expect(dataToUpdate == updatedData, true); }); @@ -98,7 +98,7 @@ void main() { await dataSource.deleteAll(); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: delete a record in user table', () async { @@ -118,7 +118,7 @@ void main() { await dataSource.delete(1); List allData = await dataSource.all(); - expect(allData.length == 0, true); + expect(allData.isEmpty, true); }); test('test: get all records in user table', () async { diff --git a/test/tests.dart b/test/tests.dart index 0e0382c1..be7e73ea 100644 --- a/test/tests.dart +++ b/test/tests.dart @@ -1,6 +1,6 @@ import '../test/data/local/all_tests.dart' as local_database_test; -main(List args) { +void main(List args) { local_database_test.main(args); } \ No newline at end of file From 5627e72d60d221fb54c876fe9bd63660c9226c95 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 10 Mar 2020 17:11:54 +0300 Subject: [PATCH 13/15] Static analysis update for workflows. --- lib/data/local/data_source.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/data/local/data_source.dart b/lib/data/local/data_source.dart index 8f45935b..d9e9ab87 100644 --- a/lib/data/local/data_source.dart +++ b/lib/data/local/data_source.dart @@ -85,7 +85,7 @@ abstract class DataSource { await db.close(); } - checkDatabaseConnection() { + void checkDatabaseConnection() { if (db == null) { throw Exception( 'No open connection to database - call .open() on the datasource to establish a connection to the database'); From 940cb0a19f77186edc99ff06c3b534dbfbff21a1 Mon Sep 17 00:00:00 2001 From: 4seer <59827284+4seer@users.noreply.github.com> Date: Tue, 10 Mar 2020 17:16:05 +0300 Subject: [PATCH 14/15] Update ci/cd workflow for master branch --- .github/workflows/dart.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 664337ae..40ce549d 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -2,9 +2,9 @@ name: Dart CI on: push: - branches: [ dev_cicd_tests ] + branches: [ master ] pull_request: - branches: [ dev_cicd_tests ] + branches: [ master ] jobs: From 005fe9980ffa733fc5c8133da40163aab24d5fe1 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 10 Mar 2020 17:21:22 +0300 Subject: [PATCH 15/15] Pedantic package --- pubspec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 61b3192e..98063ac3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,7 +39,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - pedantic: 1.8.0+1 dependency_overrides: pedantic: ^1.9.0