From 44372cf7332e3bda66e7658ce5b871c68518ee06 Mon Sep 17 00:00:00 2001
From: github actions
Date: Wed, 19 Feb 2025 01:21:31 +0500
Subject: [PATCH 1/4] ! F upgraded dependencies and some minor fix
---
.github/workflows/auto_deploy.yml | 3 -
.github/workflows/build_and_test.yml | 3 -
.github/workflows/mdsnippets.yml | 3 -
.github/workflows/publish.yml | 2 -
.../.vscode => .vscode}/tasks.json | 0
.../CHANGELOG.md => CHANGELOG.md | 4 +-
packages/approval_tests/LICENSE => LICENSE | 0
LICENSE.md | 202 ------
README.md | 103 +--
...ysis_options.yaml => analysis_options.yaml | 4 +-
.../bash => bash}/build_and_test.sh | 0
.../bash => bash}/gen_coverage_report.sh | 0
.../bash => bash}/push_release.sh | 0
.../approval_tests/bin => bin}/review.dart | 0
.../example => example}/main.dart | 0
.../main.verify_combinations.approved.txt | 0
.../verify_methods/verify/verify_test.dart | 0
.../verify_test.verify_method.approved.txt | 0
.../verify_all/verify_all_test.dart | 0
...ify_all_test.verify_all_items.approved.txt | 0
.../verify_all_combinations_test.dart | 0
...ions_test.verify_combinations.approved.txt | 0
.../verify_as_json/json_test.dart | 0
.../json_test.test_JSON_object.approved.txt | 0
.../verify_as_json/verify_as_json_test.dart | 0
...ify_as_json_test.verify_model.approved.txt | 0
.../verify_query/verify_db_query_test.dart | 0
...db_query_test.verify_db_query.approved.txt | 0
.../verify_network_query_test.dart | 0
...ery_test.verify_network_query.approved.txt | 0
.../verify_sequence/verify_sequence_test.dart | 0
...sequence_test.verify_sequence.approved.txt | 0
examples/dart_example/pubspec.yaml | 6 +-
examples/flutter_example/pubspec.yaml | 8 +-
.../lib => lib}/approval_tests.dart | 0
.../lib => lib}/src/approvals.dart | 0
.../src/comparator/file_comparator.dart | 0
.../lib => lib}/src/core/approval_number.dart | 0
.../lib => lib}/src/core/approval_writer.dart | 0
.../lib => lib}/src/core/comparator.dart | 0
.../src/core/constants/constants.dart | 0
.../src/core/enums/comporator_ide.dart | 0
.../lib => lib}/src/core/enums/file_type.dart | 0
.../approval_string_extensions.dart | 0
.../lib => lib}/src/core/logger/logger.dart | 35 +-
.../lib => lib}/src/core/options.dart | 0
.../src/core/platform_wrapper.dart | 0
.../lib => lib}/src/core/reporter.dart | 0
.../lib => lib}/src/core/scrubber.dart | 0
.../src/core/stack_trace_fetcher/fetcher.dart | 0
.../stack_trace_fetcher.dart | 0
.../lib => lib}/src/core/utils/converter.dart | 0
.../src/core/utils/executable_query.dart | 0
.../src/core/utils/file_path_extractor.dart | 0
.../lib => lib}/src/core/utils/utils.dart | 0
.../exceptions/doesnt_match_exception.dart | 0
.../exceptions/file_not_found_exception.dart | 0
.../exceptions/no_diff_tool_exception.dart | 0
.../src/namer/file_namer_options.dart | 0
.../lib => lib}/src/namer/namer.dart | 0
.../command_line/command_line_reporter.dart | 0
.../src/reporters/diff_tool/diff_info.dart | 0
.../diff_tool/diff_tool_reporter.dart | 0
.../src/reporters/diff_tool/diff_tools.dart | 0
.../lib => lib}/src/reporters/git.dart | 0
.../src/scrubbers/date_scrubber.dart | 0
.../src/scrubbers/nothing_scrubber.dart | 0
.../src/scrubbers/reg_exp_scrubber.dart | 0
.../src/writers/approval_text_writer.dart | 0
packages/approval_tests/.gitignore | 21 -
packages/approval_tests/CHANGELOG.md | 162 -----
packages/approval_tests/README.md | 307 ---------
packages/approval_tests_flutter/.gitignore | 42 --
packages/approval_tests_flutter/.metadata | 10 -
packages/approval_tests_flutter/LICENSE | 202 ------
packages/approval_tests_flutter/README.md | 335 ----------
.../analysis_options.yaml | 116 ----
.../lib/approval_tests_flutter.dart | 4 -
.../lib/src/common.dart | 15 -
.../lib/src/get_widget_names.dart | 176 ------
.../approval_tests_flutter/lib/src/src.dart | 119 ----
.../collect_widgets_meta_data.dart | 586 ------------------
.../lib/src/widget_meta/expect_meta.dart | 18 -
.../lib/src/widget_meta/load_string_en.dart | 49 --
.../lib/src/widget_meta/matcher_types.dart | 25 -
.../lib/src/widget_meta/register_types.dart | 6 -
.../lib/src/widget_meta/widget_meta.dart | 171 -----
.../widget_meta/widget_tester_extension.dart | 102 ---
packages/approval_tests_flutter/pubspec.yaml | 34 -
.../test/approval_tests_flutter_test.dart | 42 --
...tests_flutter_test.smoke_test.approved.txt | 1 -
.../test/approved/class_names.txt | 5 -
.../pubspec.yaml => pubspec.yaml | 12 +-
.../test => test}/approval_test.dart | 0
...th_filenamer.test_description.approved.txt | 0
.../approval_test.verify.approved.txt | 0
.../approval_test.verify_all.approved.txt | 0
..._test.verify_all_combinations.approved.txt | 0
...fy_all_combinations_exception.approved.txt | 0
.../approval_test.verify_as_json.approved.txt | 0
...test.verify_as_json_exception.approved.txt | 0
...val_test.verify_as_model_json.approved.txt | 0
...oval_test.verify_custom_scrub.approved.txt | 0
...proval_test.verify_date_scrub.approved.txt | 0
...pproval_test.verify_exception.approved.txt | 0
.../approval_test.verify_query.approved.txt | 0
...l_test.verify_query_exception.approved.txt | 0
.../approval_test.verify_scrub.approved.txt | 0
...approval_test.verify_sequence.approved.txt | 0
...est.verify_sequence_exception.approved.txt | 0
...est.verify_without_class_name.approved.txt | 0
.../test => test}/constants/lines.dart | 0
.../test => test}/example/example_test.dart | 0
...example_test.test_JSON_object.approved.txt | 2 +
.../groups/diff_tools_tests.dart | 0
.../test => test}/groups/exception_tests.dart | 0
.../test => test}/groups/minor_tests.dart | 0
...n_with_namer.test_description.approved.txt | 0
.../test => test}/groups/verify_tests.dart | 0
.../mock/testable_file_path_extractor.dart | 0
.../mock/testable_platform_wrapper.dart | 0
.../test => test}/models/item.dart | 0
.../queries/db_request_query.dart | 0
.../queries/network_request_query.dart | 0
.../test => test}/utils/helper.dart | 0
125 files changed, 66 insertions(+), 2869 deletions(-)
rename {packages/approval_tests/.vscode => .vscode}/tasks.json (100%)
rename packages/approval_tests_flutter/CHANGELOG.md => CHANGELOG.md (99%)
rename packages/approval_tests/LICENSE => LICENSE (100%)
delete mode 100644 LICENSE.md
rename packages/approval_tests/analysis_options.yaml => analysis_options.yaml (97%)
rename {packages/approval_tests/bash => bash}/build_and_test.sh (100%)
rename {packages/approval_tests/bash => bash}/gen_coverage_report.sh (100%)
rename {packages/approval_tests/bash => bash}/push_release.sh (100%)
rename {packages/approval_tests/bin => bin}/review.dart (100%)
rename {packages/approval_tests/example => example}/main.dart (100%)
rename {packages/approval_tests/example => example}/main.verify_combinations.approved.txt (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify/verify_test.dart (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify/verify_test.verify_method.approved.txt (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_all/verify_all_test.dart (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_all/verify_all_test.verify_all_items.approved.txt (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_all_combinations/verify_all_combinations_test.dart (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_all_combinations/verify_all_combinations_test.verify_combinations.approved.txt (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_as_json/json_test.dart (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_as_json/json_test.test_JSON_object.approved.txt (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_as_json/verify_as_json_test.dart (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_as_json/verify_as_json_test.verify_model.approved.txt (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_query/verify_db_query_test.dart (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_query/verify_db_query_test.verify_db_query.approved.txt (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_query/verify_network_query_test.dart (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_query/verify_network_query_test.verify_network_query.approved.txt (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_sequence/verify_sequence_test.dart (100%)
rename {packages/approval_tests/example => example}/verify_methods/verify_sequence/verify_sequence_test.verify_sequence.approved.txt (100%)
rename {packages/approval_tests/lib => lib}/approval_tests.dart (100%)
rename {packages/approval_tests/lib => lib}/src/approvals.dart (100%)
rename {packages/approval_tests/lib => lib}/src/comparator/file_comparator.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/approval_number.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/approval_writer.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/comparator.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/constants/constants.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/enums/comporator_ide.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/enums/file_type.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/extensions/approval_string_extensions.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/logger/logger.dart (71%)
rename {packages/approval_tests/lib => lib}/src/core/options.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/platform_wrapper.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/reporter.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/scrubber.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/stack_trace_fetcher/fetcher.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/stack_trace_fetcher/stack_trace_fetcher.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/utils/converter.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/utils/executable_query.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/utils/file_path_extractor.dart (100%)
rename {packages/approval_tests/lib => lib}/src/core/utils/utils.dart (100%)
rename {packages/approval_tests/lib => lib}/src/exceptions/doesnt_match_exception.dart (100%)
rename {packages/approval_tests/lib => lib}/src/exceptions/file_not_found_exception.dart (100%)
rename {packages/approval_tests/lib => lib}/src/exceptions/no_diff_tool_exception.dart (100%)
rename {packages/approval_tests/lib => lib}/src/namer/file_namer_options.dart (100%)
rename {packages/approval_tests/lib => lib}/src/namer/namer.dart (100%)
rename {packages/approval_tests/lib => lib}/src/reporters/command_line/command_line_reporter.dart (100%)
rename {packages/approval_tests/lib => lib}/src/reporters/diff_tool/diff_info.dart (100%)
rename {packages/approval_tests/lib => lib}/src/reporters/diff_tool/diff_tool_reporter.dart (100%)
rename {packages/approval_tests/lib => lib}/src/reporters/diff_tool/diff_tools.dart (100%)
rename {packages/approval_tests/lib => lib}/src/reporters/git.dart (100%)
rename {packages/approval_tests/lib => lib}/src/scrubbers/date_scrubber.dart (100%)
rename {packages/approval_tests/lib => lib}/src/scrubbers/nothing_scrubber.dart (100%)
rename {packages/approval_tests/lib => lib}/src/scrubbers/reg_exp_scrubber.dart (100%)
rename {packages/approval_tests/lib => lib}/src/writers/approval_text_writer.dart (100%)
delete mode 100644 packages/approval_tests/.gitignore
delete mode 100644 packages/approval_tests/CHANGELOG.md
delete mode 100644 packages/approval_tests/README.md
delete mode 100644 packages/approval_tests_flutter/.gitignore
delete mode 100644 packages/approval_tests_flutter/.metadata
delete mode 100644 packages/approval_tests_flutter/LICENSE
delete mode 100644 packages/approval_tests_flutter/README.md
delete mode 100644 packages/approval_tests_flutter/analysis_options.yaml
delete mode 100644 packages/approval_tests_flutter/lib/approval_tests_flutter.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/common.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/get_widget_names.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/src.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/widget_meta/collect_widgets_meta_data.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/widget_meta/expect_meta.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/widget_meta/load_string_en.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/widget_meta/matcher_types.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/widget_meta/register_types.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/widget_meta/widget_meta.dart
delete mode 100644 packages/approval_tests_flutter/lib/src/widget_meta/widget_tester_extension.dart
delete mode 100644 packages/approval_tests_flutter/pubspec.yaml
delete mode 100644 packages/approval_tests_flutter/test/approval_tests_flutter_test.dart
delete mode 100644 packages/approval_tests_flutter/test/approval_tests_flutter_test.smoke_test.approved.txt
delete mode 100644 packages/approval_tests_flutter/test/approved/class_names.txt
rename packages/approval_tests/pubspec.yaml => pubspec.yaml (82%)
rename {packages/approval_tests/test => test}/approval_test.dart (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.description_with_filenamer.test_description.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_all.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_all_combinations.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_all_combinations_exception.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_as_json.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_as_json_exception.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_as_model_json.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_custom_scrub.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_date_scrub.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_exception.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_query.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_query_exception.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_scrub.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_sequence.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_sequence_exception.approved.txt (100%)
rename {packages/approval_tests/test => test}/approved_files/approval_test.verify_without_class_name.approved.txt (100%)
rename {packages/approval_tests/test => test}/constants/lines.dart (100%)
rename {packages/approval_tests/test => test}/example/example_test.dart (100%)
rename {packages/approval_tests/test => test}/example/example_test.test_JSON_object.approved.txt (57%)
rename {packages/approval_tests/test => test}/groups/diff_tools_tests.dart (100%)
rename {packages/approval_tests/test => test}/groups/exception_tests.dart (100%)
rename {packages/approval_tests/test => test}/groups/minor_tests.dart (100%)
rename {packages/approval_tests/test => test}/groups/minor_tests.description_with_namer.test_description.approved.txt (100%)
rename {packages/approval_tests/test => test}/groups/verify_tests.dart (100%)
rename {packages/approval_tests/test => test}/mock/testable_file_path_extractor.dart (100%)
rename {packages/approval_tests/test => test}/mock/testable_platform_wrapper.dart (100%)
rename {packages/approval_tests/test => test}/models/item.dart (100%)
rename {packages/approval_tests/test => test}/queries/db_request_query.dart (100%)
rename {packages/approval_tests/test => test}/queries/network_request_query.dart (100%)
rename {packages/approval_tests/test => test}/utils/helper.dart (100%)
diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml
index 3c30e87..81426de 100644
--- a/.github/workflows/auto_deploy.yml
+++ b/.github/workflows/auto_deploy.yml
@@ -8,9 +8,6 @@ on:
jobs:
build:
- defaults:
- run:
- working-directory: packages/approval_tests
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index 218a841..48db5be 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -4,9 +4,6 @@ on: [push, pull_request]
jobs:
build:
- defaults:
- run:
- working-directory: packages/approval_tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
diff --git a/.github/workflows/mdsnippets.yml b/.github/workflows/mdsnippets.yml
index 670c45c..f8520fd 100644
--- a/.github/workflows/mdsnippets.yml
+++ b/.github/workflows/mdsnippets.yml
@@ -4,9 +4,6 @@ on:
jobs:
format_and_snippets:
runs-on: ubuntu-latest
- defaults:
- run:
- working-directory: packages/approval_tests
steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index f51d120..67ee621 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -10,8 +10,6 @@ jobs:
permissions:
id-token: write # Required for authentication using OIDC
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
- with:
- working-directory: packages/approval_tests
# with:
# working-directory: path/to/package/within/repository
create_release:
diff --git a/packages/approval_tests/.vscode/tasks.json b/.vscode/tasks.json
similarity index 100%
rename from packages/approval_tests/.vscode/tasks.json
rename to .vscode/tasks.json
diff --git a/packages/approval_tests_flutter/CHANGELOG.md b/CHANGELOG.md
similarity index 99%
rename from packages/approval_tests_flutter/CHANGELOG.md
rename to CHANGELOG.md
index f44a0f3..01a143e 100644
--- a/packages/approval_tests_flutter/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 1.1.4
+- Upgraded all dependencies to actuals.
+
## 1.1.3
- Updated README.md file: fix links.
@@ -13,7 +16,6 @@
## 1.1.1
- Updated README.md file.
-
## 1.1.0
- **Breaking release**:
diff --git a/packages/approval_tests/LICENSE b/LICENSE
similarity index 100%
rename from packages/approval_tests/LICENSE
rename to LICENSE
diff --git a/LICENSE.md b/LICENSE.md
deleted file mode 100644
index 9cc816b..0000000
--- a/LICENSE.md
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2024 shodev.live
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/README.md b/README.md
index 28c545a..6699061 100644
--- a/README.md
+++ b/README.md
@@ -6,12 +6,12 @@
- Approval Tests implementation in Dart / Flutter 🚀
+ Approval Tests implementation in Dart 🚀
-
+
@@ -36,8 +36,6 @@ In normal unit testing, you say `expect(person.getAge(), 5)`. Approvals allow yo
I am writing an implementation of **[Approval Tests](https://approvaltests.com/)** in Dart. If anyone wants to help, please **[text](https://t.me/yelmuratoff)** me. 🙏
-Thanks to **[Richard Coutts](https://github.com/buttonsrtoys)** for special contributions to the `approval_tests_flutter` package.
-
## Packages
ApprovalTests is designed for two level: Dart and Flutter.
@@ -54,68 +52,27 @@ ApprovalTests is designed for two level: Dart and Flutter.
- If there's a difference, a `reporter` tool will highlight the mismatch and the test fails.
- If the test is passed, the `received` file is deleted automatically. You can change this by changing the `deleteReceivedFile` value in `options`. If the test fails, the received file remains for analysis.
-Instead of writing:
-```dart
- testWidgets('home page', (WidgetTester tester) async {
- await tester.pumpWidget(const MyApp());
- await tester.pumpAndSettle();
-
- expect(find.text('You have pushed the button this many times:'), findsOneWidget);
- expect(find.text('0'), findsOneWidget);
- expect(find.byWidgetPredicate(
- (Widget widget) => widget is Text && widget.data == 'hello' &&
- widget.key == ValueKey('myKey'),
- ), findsOneWidget);
- expect(find.text('Approved Example'), findsOneWidget);
- });
-```
-
-Write this:
-```dart
- testWidgets('smoke test', (WidgetTester tester) async {
- await tester.pumpWidget(const MyApp());
- await tester.pumpAndSettle();
-
- await tester.approvalTest();
- });
-```
-
-Suppose you wanted to confirm that a page loaded with all the widget you expected. To do this,
-perform an approval test by calling `tester.approvalTest`, and give your test a suitable name:
-
-```dart
- testWidget('home page', () {
- await tester.pumpWidget(const MyApp());
- await tester.pumpAndSettle();
-
- await tester.approvalTest(description: 'all widgets load correctly');
- });
-```
-
-To include your project's custom widget types in your test, and to perform post-test checks, add
-calls to `Approved.setUpAll()` to your tests' `setUpAll` calls, like so:
-
-```dart
- main() {
- setUpAll(() {
- Approved.setUpAll();
- });
- }
-```
## 📦 Installation
Add the following to your `pubspec.yaml` file:
```yaml
dependencies:
- approval_tests: ^1.1.3
- approval_tests_flutter: ^1.1.3 # If you need. This package is needed for widget and integration tests. You can remove `approval_tests` if you use flutter package.
+ approval_tests: ^1.1.0
```
## 👀 Getting Started
-The best way to get started is to download and open the example project:
-* [Flutter example project](https://github.com/approvals/ApprovalTests.Dart/tree/main/examples/flutter_example)
+The best way to get started is to download and open the starter project:
+* [Approvaltests.Dart.StarterProject](https://github.com/approvals/Approvaltests.Dart.StarterProject)
+
+This is a standard project that can be imported into any editor or IDE and also includes CI with GitHub Actions.
+
+It comes ready with:
+
+- A suitable `.gitignore` to exclude approval artifacts
+- A ready linter with all rules in place
+- A GitHub action to run tests and you can always check the status of the tests on the badge in the `README.md` file.
## 📚 How to use
@@ -149,25 +106,11 @@ After running the command, the files will be analyzed and you will be asked to c
- `n` - Reject the received file.
- `v`iew - View the differences between the received and approved files. After selecting `v` you will be asked which IDE you want to use to view the differences.
-The command `dart run approval_tests:review` has additional options, including listing files, selecting
- files to review from this list by index, and more. For its current capabilities, run
- ```bash
- dart run approval_tests:review --help
- ```
- Typing 'dart run approval_tests:review' is tedious! To reduce your typing, alias the command in your
- `.zshrc` or `.bashrc` file
- ```
- alias review='dart run approval_tests:review'
- ```
- or PowerShell profile
- ```shell
- function review {
- dart run approval_tests:review
- }
- ```
#### • Via approveResult property
If you want the result to be automatically saved after running the test, you need to use the `approveResult` property in `Options`:
+
+
```dart
void main() {
test('test JSON object', () {
@@ -186,10 +129,13 @@ void main() {
});
}
```
+snippet source | anchor
+
this will result in the following file
`example_test.test_JSON_object.approved.txt`
-
+
+
```txt
{
"name": "JsonTest",
@@ -200,6 +146,8 @@ this will result in the following file
"version": 0.1
}
```
+snippet source | anchor
+
#### • Via file rename
You can just rename the `.received` file to `.approved`.
@@ -242,6 +190,8 @@ And the `verify_methods` folder has small examples of using different `ApprovalT
### JSON example
With `verifyAsJson`, if you pass data models as `JsonItem`, with nested other models as `AnotherItem` and `SubItem`, then you need to add an `toJson` method to each model for the serialization to succeed.
+
+
```dart
void main() {
const jsonItem = JsonItem(
@@ -271,10 +221,13 @@ void main() {
});
}
```
+snippet source | anchor
+
this will result in the following file
`verify_as_json_test.verify_model.approved.txt`
-
+
+
```txt
{
"jsonItem": {
@@ -301,6 +254,8 @@ this will result in the following file
}
}
```
+snippet source | anchor
+
diff --git a/packages/approval_tests/analysis_options.yaml b/analysis_options.yaml
similarity index 97%
rename from packages/approval_tests/analysis_options.yaml
rename to analysis_options.yaml
index 543849e..5e3c239 100644
--- a/packages/approval_tests/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,5 +1,3 @@
-include: package:sizzle_lints/sizzle_lints.yaml
-
analyzer:
errors:
depend_on_referenced_packages: ignore
@@ -112,4 +110,4 @@ dart_code_metrics:
- unnecessary-trailing-comma
- prefer-declaring-const-constructor
- prefer-single-widget-per-file:
- ignore-private-widgets: true
\ No newline at end of file
+ ignore-private-widgets: true
diff --git a/packages/approval_tests/bash/build_and_test.sh b/bash/build_and_test.sh
similarity index 100%
rename from packages/approval_tests/bash/build_and_test.sh
rename to bash/build_and_test.sh
diff --git a/packages/approval_tests/bash/gen_coverage_report.sh b/bash/gen_coverage_report.sh
similarity index 100%
rename from packages/approval_tests/bash/gen_coverage_report.sh
rename to bash/gen_coverage_report.sh
diff --git a/packages/approval_tests/bash/push_release.sh b/bash/push_release.sh
similarity index 100%
rename from packages/approval_tests/bash/push_release.sh
rename to bash/push_release.sh
diff --git a/packages/approval_tests/bin/review.dart b/bin/review.dart
similarity index 100%
rename from packages/approval_tests/bin/review.dart
rename to bin/review.dart
diff --git a/packages/approval_tests/example/main.dart b/example/main.dart
similarity index 100%
rename from packages/approval_tests/example/main.dart
rename to example/main.dart
diff --git a/packages/approval_tests/example/main.verify_combinations.approved.txt b/example/main.verify_combinations.approved.txt
similarity index 100%
rename from packages/approval_tests/example/main.verify_combinations.approved.txt
rename to example/main.verify_combinations.approved.txt
diff --git a/packages/approval_tests/example/verify_methods/verify/verify_test.dart b/example/verify_methods/verify/verify_test.dart
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify/verify_test.dart
rename to example/verify_methods/verify/verify_test.dart
diff --git a/packages/approval_tests/example/verify_methods/verify/verify_test.verify_method.approved.txt b/example/verify_methods/verify/verify_test.verify_method.approved.txt
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify/verify_test.verify_method.approved.txt
rename to example/verify_methods/verify/verify_test.verify_method.approved.txt
diff --git a/packages/approval_tests/example/verify_methods/verify_all/verify_all_test.dart b/example/verify_methods/verify_all/verify_all_test.dart
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_all/verify_all_test.dart
rename to example/verify_methods/verify_all/verify_all_test.dart
diff --git a/packages/approval_tests/example/verify_methods/verify_all/verify_all_test.verify_all_items.approved.txt b/example/verify_methods/verify_all/verify_all_test.verify_all_items.approved.txt
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_all/verify_all_test.verify_all_items.approved.txt
rename to example/verify_methods/verify_all/verify_all_test.verify_all_items.approved.txt
diff --git a/packages/approval_tests/example/verify_methods/verify_all_combinations/verify_all_combinations_test.dart b/example/verify_methods/verify_all_combinations/verify_all_combinations_test.dart
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_all_combinations/verify_all_combinations_test.dart
rename to example/verify_methods/verify_all_combinations/verify_all_combinations_test.dart
diff --git a/packages/approval_tests/example/verify_methods/verify_all_combinations/verify_all_combinations_test.verify_combinations.approved.txt b/example/verify_methods/verify_all_combinations/verify_all_combinations_test.verify_combinations.approved.txt
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_all_combinations/verify_all_combinations_test.verify_combinations.approved.txt
rename to example/verify_methods/verify_all_combinations/verify_all_combinations_test.verify_combinations.approved.txt
diff --git a/packages/approval_tests/example/verify_methods/verify_as_json/json_test.dart b/example/verify_methods/verify_as_json/json_test.dart
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_as_json/json_test.dart
rename to example/verify_methods/verify_as_json/json_test.dart
diff --git a/packages/approval_tests/example/verify_methods/verify_as_json/json_test.test_JSON_object.approved.txt b/example/verify_methods/verify_as_json/json_test.test_JSON_object.approved.txt
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_as_json/json_test.test_JSON_object.approved.txt
rename to example/verify_methods/verify_as_json/json_test.test_JSON_object.approved.txt
diff --git a/packages/approval_tests/example/verify_methods/verify_as_json/verify_as_json_test.dart b/example/verify_methods/verify_as_json/verify_as_json_test.dart
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_as_json/verify_as_json_test.dart
rename to example/verify_methods/verify_as_json/verify_as_json_test.dart
diff --git a/packages/approval_tests/example/verify_methods/verify_as_json/verify_as_json_test.verify_model.approved.txt b/example/verify_methods/verify_as_json/verify_as_json_test.verify_model.approved.txt
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_as_json/verify_as_json_test.verify_model.approved.txt
rename to example/verify_methods/verify_as_json/verify_as_json_test.verify_model.approved.txt
diff --git a/packages/approval_tests/example/verify_methods/verify_query/verify_db_query_test.dart b/example/verify_methods/verify_query/verify_db_query_test.dart
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_query/verify_db_query_test.dart
rename to example/verify_methods/verify_query/verify_db_query_test.dart
diff --git a/packages/approval_tests/example/verify_methods/verify_query/verify_db_query_test.verify_db_query.approved.txt b/example/verify_methods/verify_query/verify_db_query_test.verify_db_query.approved.txt
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_query/verify_db_query_test.verify_db_query.approved.txt
rename to example/verify_methods/verify_query/verify_db_query_test.verify_db_query.approved.txt
diff --git a/packages/approval_tests/example/verify_methods/verify_query/verify_network_query_test.dart b/example/verify_methods/verify_query/verify_network_query_test.dart
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_query/verify_network_query_test.dart
rename to example/verify_methods/verify_query/verify_network_query_test.dart
diff --git a/packages/approval_tests/example/verify_methods/verify_query/verify_network_query_test.verify_network_query.approved.txt b/example/verify_methods/verify_query/verify_network_query_test.verify_network_query.approved.txt
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_query/verify_network_query_test.verify_network_query.approved.txt
rename to example/verify_methods/verify_query/verify_network_query_test.verify_network_query.approved.txt
diff --git a/packages/approval_tests/example/verify_methods/verify_sequence/verify_sequence_test.dart b/example/verify_methods/verify_sequence/verify_sequence_test.dart
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_sequence/verify_sequence_test.dart
rename to example/verify_methods/verify_sequence/verify_sequence_test.dart
diff --git a/packages/approval_tests/example/verify_methods/verify_sequence/verify_sequence_test.verify_sequence.approved.txt b/example/verify_methods/verify_sequence/verify_sequence_test.verify_sequence.approved.txt
similarity index 100%
rename from packages/approval_tests/example/verify_methods/verify_sequence/verify_sequence_test.verify_sequence.approved.txt
rename to example/verify_methods/verify_sequence/verify_sequence_test.verify_sequence.approved.txt
diff --git a/examples/dart_example/pubspec.yaml b/examples/dart_example/pubspec.yaml
index 4c2b227..26af55d 100644
--- a/examples/dart_example/pubspec.yaml
+++ b/examples/dart_example/pubspec.yaml
@@ -1,7 +1,7 @@
name: dart_application
description: A sample command-line application.
version: 1.0.0
-publish_to: 'none'
+publish_to: "none"
environment:
sdk: ^3.4.0
@@ -9,8 +9,8 @@ environment:
# Add regular dependencies here.
dependencies:
approval_tests:
- path: ../../packages/approval_tests
+ path: ../../
dev_dependencies:
lints: ^4.0.0
- test: ^1.24.0
\ No newline at end of file
+ test: ^1.24.0
diff --git a/examples/flutter_example/pubspec.yaml b/examples/flutter_example/pubspec.yaml
index 44a9347..0a4e4f4 100644
--- a/examples/flutter_example/pubspec.yaml
+++ b/examples/flutter_example/pubspec.yaml
@@ -1,11 +1,11 @@
name: flutter_example
description: "A new Flutter project."
-publish_to: 'none'
+publish_to: "none"
version: 1.0.0+1
environment:
- sdk: '>=3.4.1 <4.0.0'
+ sdk: ">=3.4.1 <4.0.0"
dependencies:
flutter:
@@ -13,10 +13,10 @@ dependencies:
flutter_test:
sdk: flutter
approval_tests_flutter:
- path: ../../packages/approval_tests_flutter
+ path: ../../../ApprovalTests.Dart.Flutter/
dev_dependencies:
flutter_lints: ^4.0.0
flutter:
- uses-material-design: true
\ No newline at end of file
+ uses-material-design: true
diff --git a/packages/approval_tests/lib/approval_tests.dart b/lib/approval_tests.dart
similarity index 100%
rename from packages/approval_tests/lib/approval_tests.dart
rename to lib/approval_tests.dart
diff --git a/packages/approval_tests/lib/src/approvals.dart b/lib/src/approvals.dart
similarity index 100%
rename from packages/approval_tests/lib/src/approvals.dart
rename to lib/src/approvals.dart
diff --git a/packages/approval_tests/lib/src/comparator/file_comparator.dart b/lib/src/comparator/file_comparator.dart
similarity index 100%
rename from packages/approval_tests/lib/src/comparator/file_comparator.dart
rename to lib/src/comparator/file_comparator.dart
diff --git a/packages/approval_tests/lib/src/core/approval_number.dart b/lib/src/core/approval_number.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/approval_number.dart
rename to lib/src/core/approval_number.dart
diff --git a/packages/approval_tests/lib/src/core/approval_writer.dart b/lib/src/core/approval_writer.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/approval_writer.dart
rename to lib/src/core/approval_writer.dart
diff --git a/packages/approval_tests/lib/src/core/comparator.dart b/lib/src/core/comparator.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/comparator.dart
rename to lib/src/core/comparator.dart
diff --git a/packages/approval_tests/lib/src/core/constants/constants.dart b/lib/src/core/constants/constants.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/constants/constants.dart
rename to lib/src/core/constants/constants.dart
diff --git a/packages/approval_tests/lib/src/core/enums/comporator_ide.dart b/lib/src/core/enums/comporator_ide.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/enums/comporator_ide.dart
rename to lib/src/core/enums/comporator_ide.dart
diff --git a/packages/approval_tests/lib/src/core/enums/file_type.dart b/lib/src/core/enums/file_type.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/enums/file_type.dart
rename to lib/src/core/enums/file_type.dart
diff --git a/packages/approval_tests/lib/src/core/extensions/approval_string_extensions.dart b/lib/src/core/extensions/approval_string_extensions.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/extensions/approval_string_extensions.dart
rename to lib/src/core/extensions/approval_string_extensions.dart
diff --git a/packages/approval_tests/lib/src/core/logger/logger.dart b/lib/src/core/logger/logger.dart
similarity index 71%
rename from packages/approval_tests/lib/src/core/logger/logger.dart
rename to lib/src/core/logger/logger.dart
index f558752..ef5b89b 100644
--- a/packages/approval_tests/lib/src/core/logger/logger.dart
+++ b/lib/src/core/logger/logger.dart
@@ -28,13 +28,13 @@ final class ApprovalLogger {
settings: TalkerSettings(
titles: _defaultTitles,
colors: {
- TalkerLogType.critical: AnsiPen()..red(),
- TalkerLogType.warning: AnsiPen()..yellow(),
- TalkerLogType.verbose: AnsiPen()..gray(),
- TalkerLogType.info: AnsiPen()..cyan(),
- TalkerLogType.debug: AnsiPen()..gray(),
- TalkerLogType.error: ApprovalUtils.hexToAnsiPen('de7979'),
- TalkerLogType.exception: ApprovalUtils.hexToAnsiPen('de7979'),
+ TalkerLogType.critical.key: AnsiPen()..red(),
+ TalkerLogType.warning.key: AnsiPen()..yellow(),
+ TalkerLogType.verbose.key: AnsiPen()..gray(),
+ TalkerLogType.info.key: AnsiPen()..cyan(),
+ TalkerLogType.debug.key: AnsiPen()..gray(),
+ TalkerLogType.error.key: ApprovalUtils.hexToAnsiPen('de7979'),
+ TalkerLogType.exception.key: ApprovalUtils.hexToAnsiPen('de7979'),
},
),
),
@@ -47,22 +47,23 @@ final class ApprovalLogger {
static const _approvalTitle = "ApprovalTests";
// Define default titles for different log types.
- static const _defaultTitles = {
- TalkerLogType.critical: '💀 $_approvalTitle',
- TalkerLogType.warning: '🟡 $_approvalTitle',
- TalkerLogType.verbose: '🐛 $_approvalTitle',
- TalkerLogType.info: '🔍 $_approvalTitle',
- TalkerLogType.debug: '🐛 $_approvalTitle',
- TalkerLogType.error: '🔴 $_approvalTitle',
- TalkerLogType.exception: '🔴 $_approvalTitle',
+ static Map _defaultTitles = {
+ TalkerLogType.critical.key: '💀 $_approvalTitle',
+ TalkerLogType.warning.key: '🟡 $_approvalTitle',
+ TalkerLogType.verbose.key: '🐛 $_approvalTitle',
+ TalkerLogType.info.key: '🔍 $_approvalTitle',
+ TalkerLogType.debug.key: '🐛 $_approvalTitle',
+ TalkerLogType.error.key: '🔴 $_approvalTitle',
+ TalkerLogType.exception.key: '🔴 $_approvalTitle',
};
/// `log` method to log messages with debug log level.
static void log(String message) => _instance._logger.debug(message);
/// `info` method to log messages with success log level.
- static void success(String message) =>
- _instance._logger.logTyped(_SuccessLog(message));
+ static void success(String message) => _instance._logger.logCustom(
+ _SuccessLog(message),
+ );
/// `warning` method to log messages with warning log level.
static void warning(String message) => _instance._logger.warning(message);
diff --git a/packages/approval_tests/lib/src/core/options.dart b/lib/src/core/options.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/options.dart
rename to lib/src/core/options.dart
diff --git a/packages/approval_tests/lib/src/core/platform_wrapper.dart b/lib/src/core/platform_wrapper.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/platform_wrapper.dart
rename to lib/src/core/platform_wrapper.dart
diff --git a/packages/approval_tests/lib/src/core/reporter.dart b/lib/src/core/reporter.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/reporter.dart
rename to lib/src/core/reporter.dart
diff --git a/packages/approval_tests/lib/src/core/scrubber.dart b/lib/src/core/scrubber.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/scrubber.dart
rename to lib/src/core/scrubber.dart
diff --git a/packages/approval_tests/lib/src/core/stack_trace_fetcher/fetcher.dart b/lib/src/core/stack_trace_fetcher/fetcher.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/stack_trace_fetcher/fetcher.dart
rename to lib/src/core/stack_trace_fetcher/fetcher.dart
diff --git a/packages/approval_tests/lib/src/core/stack_trace_fetcher/stack_trace_fetcher.dart b/lib/src/core/stack_trace_fetcher/stack_trace_fetcher.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/stack_trace_fetcher/stack_trace_fetcher.dart
rename to lib/src/core/stack_trace_fetcher/stack_trace_fetcher.dart
diff --git a/packages/approval_tests/lib/src/core/utils/converter.dart b/lib/src/core/utils/converter.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/utils/converter.dart
rename to lib/src/core/utils/converter.dart
diff --git a/packages/approval_tests/lib/src/core/utils/executable_query.dart b/lib/src/core/utils/executable_query.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/utils/executable_query.dart
rename to lib/src/core/utils/executable_query.dart
diff --git a/packages/approval_tests/lib/src/core/utils/file_path_extractor.dart b/lib/src/core/utils/file_path_extractor.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/utils/file_path_extractor.dart
rename to lib/src/core/utils/file_path_extractor.dart
diff --git a/packages/approval_tests/lib/src/core/utils/utils.dart b/lib/src/core/utils/utils.dart
similarity index 100%
rename from packages/approval_tests/lib/src/core/utils/utils.dart
rename to lib/src/core/utils/utils.dart
diff --git a/packages/approval_tests/lib/src/exceptions/doesnt_match_exception.dart b/lib/src/exceptions/doesnt_match_exception.dart
similarity index 100%
rename from packages/approval_tests/lib/src/exceptions/doesnt_match_exception.dart
rename to lib/src/exceptions/doesnt_match_exception.dart
diff --git a/packages/approval_tests/lib/src/exceptions/file_not_found_exception.dart b/lib/src/exceptions/file_not_found_exception.dart
similarity index 100%
rename from packages/approval_tests/lib/src/exceptions/file_not_found_exception.dart
rename to lib/src/exceptions/file_not_found_exception.dart
diff --git a/packages/approval_tests/lib/src/exceptions/no_diff_tool_exception.dart b/lib/src/exceptions/no_diff_tool_exception.dart
similarity index 100%
rename from packages/approval_tests/lib/src/exceptions/no_diff_tool_exception.dart
rename to lib/src/exceptions/no_diff_tool_exception.dart
diff --git a/packages/approval_tests/lib/src/namer/file_namer_options.dart b/lib/src/namer/file_namer_options.dart
similarity index 100%
rename from packages/approval_tests/lib/src/namer/file_namer_options.dart
rename to lib/src/namer/file_namer_options.dart
diff --git a/packages/approval_tests/lib/src/namer/namer.dart b/lib/src/namer/namer.dart
similarity index 100%
rename from packages/approval_tests/lib/src/namer/namer.dart
rename to lib/src/namer/namer.dart
diff --git a/packages/approval_tests/lib/src/reporters/command_line/command_line_reporter.dart b/lib/src/reporters/command_line/command_line_reporter.dart
similarity index 100%
rename from packages/approval_tests/lib/src/reporters/command_line/command_line_reporter.dart
rename to lib/src/reporters/command_line/command_line_reporter.dart
diff --git a/packages/approval_tests/lib/src/reporters/diff_tool/diff_info.dart b/lib/src/reporters/diff_tool/diff_info.dart
similarity index 100%
rename from packages/approval_tests/lib/src/reporters/diff_tool/diff_info.dart
rename to lib/src/reporters/diff_tool/diff_info.dart
diff --git a/packages/approval_tests/lib/src/reporters/diff_tool/diff_tool_reporter.dart b/lib/src/reporters/diff_tool/diff_tool_reporter.dart
similarity index 100%
rename from packages/approval_tests/lib/src/reporters/diff_tool/diff_tool_reporter.dart
rename to lib/src/reporters/diff_tool/diff_tool_reporter.dart
diff --git a/packages/approval_tests/lib/src/reporters/diff_tool/diff_tools.dart b/lib/src/reporters/diff_tool/diff_tools.dart
similarity index 100%
rename from packages/approval_tests/lib/src/reporters/diff_tool/diff_tools.dart
rename to lib/src/reporters/diff_tool/diff_tools.dart
diff --git a/packages/approval_tests/lib/src/reporters/git.dart b/lib/src/reporters/git.dart
similarity index 100%
rename from packages/approval_tests/lib/src/reporters/git.dart
rename to lib/src/reporters/git.dart
diff --git a/packages/approval_tests/lib/src/scrubbers/date_scrubber.dart b/lib/src/scrubbers/date_scrubber.dart
similarity index 100%
rename from packages/approval_tests/lib/src/scrubbers/date_scrubber.dart
rename to lib/src/scrubbers/date_scrubber.dart
diff --git a/packages/approval_tests/lib/src/scrubbers/nothing_scrubber.dart b/lib/src/scrubbers/nothing_scrubber.dart
similarity index 100%
rename from packages/approval_tests/lib/src/scrubbers/nothing_scrubber.dart
rename to lib/src/scrubbers/nothing_scrubber.dart
diff --git a/packages/approval_tests/lib/src/scrubbers/reg_exp_scrubber.dart b/lib/src/scrubbers/reg_exp_scrubber.dart
similarity index 100%
rename from packages/approval_tests/lib/src/scrubbers/reg_exp_scrubber.dart
rename to lib/src/scrubbers/reg_exp_scrubber.dart
diff --git a/packages/approval_tests/lib/src/writers/approval_text_writer.dart b/lib/src/writers/approval_text_writer.dart
similarity index 100%
rename from packages/approval_tests/lib/src/writers/approval_text_writer.dart
rename to lib/src/writers/approval_text_writer.dart
diff --git a/packages/approval_tests/.gitignore b/packages/approval_tests/.gitignore
deleted file mode 100644
index 0055b6e..0000000
--- a/packages/approval_tests/.gitignore
+++ /dev/null
@@ -1,21 +0,0 @@
-# https://dart.dev/guides/libraries/private-files
-# Created by `dart pub`
-.dart_tool/
-.idea
-
-# Coverage
-coverage/
-
-# Pubspec
-pubspec.lock
-
-# Codegen
-*.*.dart
-*.g.dart
-*.received.*
-generated_*
-
-# Other files
-.old.dart
-
-.DS_Store
diff --git a/packages/approval_tests/CHANGELOG.md b/packages/approval_tests/CHANGELOG.md
deleted file mode 100644
index 2735075..0000000
--- a/packages/approval_tests/CHANGELOG.md
+++ /dev/null
@@ -1,162 +0,0 @@
-## 1.1.3
-- Updated README.md file: fix links.
-
-## 1.1.2
-- Added CLI additional options:
- Usage: `dart run approval_tests:review [arguments]`
- - Arguments:
- - `--help` Print this usage information.
- - `--list` Print a list of project .received.txt files.
- - `` Review an .received.txt file indexed by --list.
- - `` Review an .received.txt file.
-
-## 1.1.1
-- Updated README.md file.
-
-## 1.1.0
-
-- **Breaking release**:
- - Added new reporter: `GitReporter`. It allows you to use `git` to view the differences between the received and approved files.
- - Added support to approve files using CLI. Now you can approve files using the command line: `dart run approval_tests:review`
- - Added support to use ApprovalTests during widget tests.
- - Added header to generated files. For resolved issues you can add this to approved files:
- '# This file was generated by approval_tests. Please do not edit.\n'
- - Some minor changes and code improvements.
-Thanks to [Richard Coutts](https://github.com/buttonsrtoys)
-
-## 1.0.0
-
-- Initial major release.
-
-## 0.5.1
-
-- Updated documentation.
-- Updated dependencies.
-- Updated `README.md` file.
-- Updated `TODO.md` file.
-- Rewrited comparators. Now it is only FileComparator.
-- Rewrited Scrubbers: regex scrubber, date scrubber.
-- Now, first run automatically create approved snapshot. You can approve another snapshot by setting `approveResult` to `true` and using Diff Tool.
-- Completely rewritten `CommandLineReporter`.
-There were changes with the comparison method, as well as highlighting by color the places where there are differences. Green - approved. White text on red background - Differences in received file.
-- Internal updates such as:
- - Adding android studio installation via github actions to test Diff Reporter on different devices.
- - Full code test coverage after significant changes.
- - Changes to getting file name and path depending on platform.
-
-## 0.4.6
-
-- Updated dependencies. Removed `dcli` package.
-- Issue https://github.com/approvals/ApprovalTests.Dart/issues/3 was fixed.
-- Minor changes: `IDEComparator` now gets the current `StackTrace` if an error occurs.
-
-## 0.4.5
-
-- Updated dependencies and actions versions.
-- Updated Logger's output: now it is more informative.
-- Updated `CONTRIBUTING.md` file: added Arlo's Commit Notation.
-
-## 0.4.4
-
-- Added setup visual studio code action to the `build_and_test` workflow for test `IDEComparator`.
-
-## 0.4.3
-
-- Completed coverage of the project with tests. Now the project has 100% coverage.
-
-## 0.4.2
-
-- Autopublish to `pub.dev` if the version in `pubspec.yaml` has been changed by auto adding a new tag to the repositories.
-- Codecov added to `github` actions. Codecov badge, graph was added to `README.md`.
-- Added `mdsnippets` to `github` actions. And example snippets added to `README.md`.
-- Added `ApprovalTests.Dart.StarterProject`. You can find it in the `README.md` file.
-
-## 0.3.9
-
-- Fix with default file path if package from `pub.dev`.
-- Gilded rose moved to starter project.
-- Code formatted.
-
-## 0.3.8
-
-- Test publish action with new version: `v0.3.8`.
-
-## 0.3.6-dev
-
-- Updated `pubspec.yaml` file: changed homepage.
-
-## 0.3.5-dev
-
-- The repository has been moved to Approvals.
-- Fixed bug with checking of strings received from `txt` file.
-- Added `Github` Actions.
-- Added `dependabot`.
-- Updated `README.md` file.
-- Updated `TODO.md` file.
-
-
-## 0.3.3-dev
-
-- Updated `README.md` file.
-
-## 0.3.2-dev
-
-- Default `lints` replaced by `sizzle_lints`.
-- Updated `analysis_options` file.
-- Updated `README.md` file.
-
-## 0.3.1-dev
-
-- Updated `README.md` file.
-
-## 0.3.0-dev
-
-- Approval was refactored.
-- Added tests.
-- Code formatted.
-- `deleteReceivedFile` field was added to the `ApprovalTests` class. If it is set to `true`, the received file will be deleted after test. By default, it is set to `false`.
-- `logErrors` field was added to the `ApprovalTests` class. If it is set to `true`, the errors will be logged. By default, it is set to `true`.
-- `logResults` field was added to the `ApprovalTests` class. If it is set to `true`, the success results will be logged. By default, it is set to `true`.
-
-## 0.2.1-dev
-
-- Fix: `approval_dart` changed to `approval_tests`.
-- Code formatted.
-
-## 0.2.0-dev
-
-- I rewrote the main functions of the class. Now you can use several comparison options.
-- Added methods for comparing `JSON` strings.
-- Added methods for array comparison.
-- Improved documentation.
-- Added more examples: each method has its own small example.
-
-## 0.1.0-dev
-
-- Added `verifyAll` method to verify array of items *(or use array as inputs)*.
-- Added `verifyAllCombinationsAsJson` method to verify all combinations of items as `JSON`.
-- Updated `README.md` file.
-
-## 0.0.9-dev
-
-- Updated `README.md` file.
-
-## 0.0.8-dev
-
-- Updated `README.md` file: added examples, more info.
-
-## 0.0.7-dev
-
-- Comparator completed, some refactoring. Updated `README.md` file.
-
-## 0.0.6-dev
-
-- Some updates with `README.md` file.
-
-## 0.0.5-dev
-
-- First working version, need to expand functionality and add more flexibilty. Also need to add more tests.
-
-## 0.0.1-dev
-
-- Initial version.
\ No newline at end of file
diff --git a/packages/approval_tests/README.md b/packages/approval_tests/README.md
deleted file mode 100644
index 6699061..0000000
--- a/packages/approval_tests/README.md
+++ /dev/null
@@ -1,307 +0,0 @@
-
-
- Approval Tests implementation in Dart 🚀
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## 📖 About
-
-**[Approval Tests](https://approvaltests.com/)** are an alternative to assertions. You’ll find them useful for testing objects with complex values *(such as long strings)*, lots of properties, or collections of objects.
-
-`Approval tests` simplify this by taking a snapshot of the results, and confirming that they have not changed.
-
-In normal unit testing, you say `expect(person.getAge(), 5)`. Approvals allow you to do this when the thing that you want to assert is no longer a primitive but a complex object. For example, you can say, `Approvals.verify(person)`.
-
-I am writing an implementation of **[Approval Tests](https://approvaltests.com/)** in Dart. If anyone wants to help, please **[text](https://t.me/yelmuratoff)** me. 🙏
-
-## Packages
-ApprovalTests is designed for two level: Dart and Flutter.
-
-| Package | Version | Description |
-| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
-| [approval_tests](https://github.com/approvals/ApprovalTests.Dart/tree/main/packages/approval_tests) | [](https://pub.dev/packages/approval_tests) | **Dart** package for approval testing of `unit` tests *(main)* |
-| [approval_tests_flutter](https://github.com/approvals/ApprovalTests.Dart/tree/main/packages/approval_tests_flutter) | [](https://pub.dev/packages/approval_tests_flutter) | **Flutter** package for approval testing of `widget`, `integration` tests |
-
-
-## 📋 How it works
-
-- The first run of the test automatically creates an `approved` file if there is no such file.
-- If the changed results match the `approved` file perfectly, the test passes.
-- If there's a difference, a `reporter` tool will highlight the mismatch and the test fails.
-- If the test is passed, the `received` file is deleted automatically. You can change this by changing the `deleteReceivedFile` value in `options`. If the test fails, the received file remains for analysis.
-
-## 📦 Installation
-
-Add the following to your `pubspec.yaml` file:
-
-```yaml
-dependencies:
- approval_tests: ^1.1.0
-```
-
-## 👀 Getting Started
-
-The best way to get started is to download and open the starter project:
-* [Approvaltests.Dart.StarterProject](https://github.com/approvals/Approvaltests.Dart.StarterProject)
-
-This is a standard project that can be imported into any editor or IDE and also includes CI with GitHub Actions.
-
-It comes ready with:
-
-- A suitable `.gitignore` to exclude approval artifacts
-- A ready linter with all rules in place
-- A GitHub action to run tests and you can always check the status of the tests on the badge in the `README.md` file.
-
-## 📚 How to use
-
-In order to use `Approval Tests`, the user needs to:
-
-1. Set up a test: This involves importing the Approval Tests library into your own code.
-
-2. Optionally, set up a reporter: Reporters are tools that highlight differences between approved and received files when a test fails. Although not necessary, they make it significantly easier to see what changes have caused a test to fail. The default reporter is the `CommandLineReporter`. You can also use the `DiffReporter` to compare the files in your IDE, and the `GitReporter` to see the differences in the `Git GUI`.
-
-3. Manage the `approved` file: When the test is run for the first time, an approved file is created automatically. This file will represent the expected outcome. Once the test results in a favorable outcome, the approved file should be updated to reflect these changes. A little bit below I wrote how to do it.
-
-This setup is useful because it shortens feedback loops, saving developers time by only highlighting what has been altered rather than requiring them to parse through their entire output to see what effect their changes had.
-
-### Approving Results
-
-Approving results just means saving the `.approved.txt` file with your desired results.
-
-We’ll provide more explanation in due course, but, briefly, here are the most common approaches to do this.
-
-#### • Via Diff Tool
-Most diff tools have the ability to move text from left to right, and save the result.
-How to use diff tools is just below, there is a `Comparator` class for that.
-
-#### • Via CLI command
-You can run the command in a terminal to review your files:
-```bash
-dart run approval_tests:review
-```
-After running the command, the files will be analyzed and you will be asked to choose one of the options:
-- `y` - Approve the received file.
-- `n` - Reject the received file.
-- `v`iew - View the differences between the received and approved files. After selecting `v` you will be asked which IDE you want to use to view the differences.
-
-#### • Via approveResult property
-If you want the result to be automatically saved after running the test, you need to use the `approveResult` property in `Options`:
-
-
-
-```dart
-void main() {
- test('test JSON object', () {
- final complexObject = {
- 'name': 'JsonTest',
- 'features': ['Testing', 'JSON'],
- 'version': 0.1,
- };
-
- Approvals.verifyAsJson(
- complexObject,
- options: const Options(
- approveResult: true,
- ),
- );
- });
-}
-```
-snippet source | anchor
-
-
-this will result in the following file
-`example_test.test_JSON_object.approved.txt`
-
-
-```txt
-{
- "name": "JsonTest",
- "features": [
- "Testing",
- "JSON"
- ],
- "version": 0.1
-}
-```
-snippet source | anchor
-
-
-#### • Via file rename
-You can just rename the `.received` file to `.approved`.
-
-### Reporters
-
-Reporters are the part of Approval Tests that launch diff tools when things do not match. They are the part of the system that makes it easy to see what has changed.
-
-There are several reporters available in the package:
-- `CommandLineReporter` - This is the default reporter, which will output the diff in the terminal.
-- `GitReporter` - This reporter will open the diff in the Git GUI.
-- `DiffReporter` - This reporter will open the Diff Tool in your IDE.
- - For Diff Reporter I using the default paths to the IDE, if something didn't work then you in the console see the expected correct path to the IDE and specify customDiffInfo. You can also contact me for help.
-
-
-
-
-To use `DiffReporter` you just need to add it to `options`:
-```dart
- options: const Options(
- reporter: const DiffReporter(),
- ),
-```
-
-
-

-

-
-
-
-## 📝 Examples
-
-I have provided a couple of small examples here to show you how to use the package.
-There are more examples in the `example` folder for you to explore. I will add more examples in the future.
-Inside, in the `gilded_rose` folder, there is an example of using `ApprovalTests` to test the legacy code of [Gilded Rose kata](https://github.com/emilybache/GildedRose-Refactoring-Kata).
-You can study it to understand how to use the package to test complex code.
-
-And the `verify_methods` folder has small examples of using different `ApprovalTests` methods for different cases.
-
-### JSON example
-With `verifyAsJson`, if you pass data models as `JsonItem`, with nested other models as `AnotherItem` and `SubItem`, then you need to add an `toJson` method to each model for the serialization to succeed.
-
-
-
-```dart
-void main() {
- const jsonItem = JsonItem(
- id: 1,
- name: "JsonItem",
- anotherItem: AnotherItem(id: 1, name: "AnotherItem"),
- subItem: SubItem(
- id: 1,
- name: "SubItem",
- anotherItems: [
- AnotherItem(id: 1, name: "AnotherItem 1"),
- AnotherItem(id: 2, name: "AnotherItem 2"),
- ],
- ),
- );
-
- test('verify model', () {
- Approvals.verifyAsJson(
- jsonItem,
- options: const Options(
- deleteReceivedFile:
- true, // Automatically delete the received file after the test.
- approveResult:
- true, // Approve the result automatically. You can remove this property after the approved file is created.
- ),
- );
- });
-}
-```
-snippet source | anchor
-
-
-this will result in the following file
-`verify_as_json_test.verify_model.approved.txt`
-
-
-```txt
-{
- "jsonItem": {
- "id": 1,
- "name": "JsonItem",
- "subItem": {
- "id": 1,
- "name": "SubItem",
- "anotherItems": [
- {
- "id": 1,
- "name": "AnotherItem 1"
- },
- {
- "id": 2,
- "name": "AnotherItem 2"
- }
- ]
- },
- "anotherItem": {
- "id": 1,
- "name": "AnotherItem"
- }
- }
-}
-```
-snippet source | anchor
-
-
-
-
-
-## ❓ Which File Artifacts to Exclude from Source Control
-You must add any `approved` files to your source control system. But `received` files can change with any run and should be ignored. For Git, add this to your `.gitignore`:
-
-```gitignore
-*.received.*
-```
-
-## ✉️ For More Information
-### Questions?
-Ask me on Telegram: [`@yelmuratoff`](https://t.me/yelmuratoff).
-Email: [`yelamanyelmuratov@gmail.com`](mailto:yelamanyelmuratov@gmail.com)
-
-### Video Tutorials
-- [Getting Started with ApprovalTests.Swift](https://qualitycoding.org/approvaltests-swift-getting-started/)
-- [How to Verify Objects (and Simplify TDD)](https://qualitycoding.org/approvaltests-swift-verify-objects/)
-- [Verify Arrays and See Simple, Clear Diffs](https://qualitycoding.org/verify-arrays-approvaltests-swift/)
-- [Write Parameterized Tests by Transforming Sequences](https://qualitycoding.org/parameterized-tests-approvaltests-swift/)
-- [Wrangle Legacy Code with Combination Approvals](https://qualitycoding.org/wrangle-legacy-code-combination-approvals/)
-
-You can also watch a series of short videos about [using ApprovalTests in .Net](https://www.youtube.com/playlist?list=PL0C32F89E8BBB5368) on YouTube.
-
-### Podcasts
-Prefer learning by listening? Then you might enjoy the following podcasts:
-
-- [Hanselminutes](https://www.hanselminutes.com/360/approval-tests-with-llewellyn-falco)
-- [Herding Code](https://www.developerfusion.com/media/122649/herding-code-117-llewellyn-falcon-on-approval-tests/)
-- [The Watir Podcast](https://watirpodcast.com/podcast-53/)
-
-## Coverage
-
-[](https://codecov.io/gh/approvals/ApprovalTests.Dart/branch/main)
-
-## 🤝 Contributing
-Show some 💙 and star the repo to support the project! 🙌
-The project is in the process of development and we invite you to contribute through pull requests and issue submissions. 👍
-We appreciate your support. 🫰
-
-
-
-
Thanks to all contributors of this package
-
-
-
-
-
diff --git a/packages/approval_tests_flutter/.gitignore b/packages/approval_tests_flutter/.gitignore
deleted file mode 100644
index 3aeec29..0000000
--- a/packages/approval_tests_flutter/.gitignore
+++ /dev/null
@@ -1,42 +0,0 @@
-# Miscellaneous
-*.class
-*.log
-*.pyc
-*.swp
-.DS_Store
-.atom/
-.buildlog/
-.history
-.svn/
-migrate_working_dir/
-
-# IntelliJ related
-*.iml
-*.ipr
-*.iws
-.idea/
-
-# The .vscode folder contains launch configuration and tasks you configure in
-# VS Code which you may wish to be included in version control, so this line
-# is commented out by default.
-#.vscode/
-
-# Flutter/Dart/Pub related
-# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
-/pubspec.lock
-**/doc/api/
-.dart_tool/
-build/
-
-# Coverage
-coverage/
-
-# Codegen
-*.*.dart
-*.g.dart
-*.received.*
-generated_*
-
-# Other files
-.old.dart
-.DS_Store
diff --git a/packages/approval_tests_flutter/.metadata b/packages/approval_tests_flutter/.metadata
deleted file mode 100644
index 8f7b6ac..0000000
--- a/packages/approval_tests_flutter/.metadata
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file tracks properties of this Flutter project.
-# Used by Flutter tool to assess capabilities and perform upgrades etc.
-#
-# This file should be version controlled and should not be manually edited.
-
-version:
- revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49"
- channel: "stable"
-
-project_type: package
diff --git a/packages/approval_tests_flutter/LICENSE b/packages/approval_tests_flutter/LICENSE
deleted file mode 100644
index 9cc816b..0000000
--- a/packages/approval_tests_flutter/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2024 shodev.live
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/packages/approval_tests_flutter/README.md b/packages/approval_tests_flutter/README.md
deleted file mode 100644
index 35929b7..0000000
--- a/packages/approval_tests_flutter/README.md
+++ /dev/null
@@ -1,335 +0,0 @@
-
-
- Approval Tests implementation in Flutter 🚀
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## 📖 About
-
-**[Approval Tests](https://approvaltests.com/)** are an alternative to assertions. You’ll find them useful for testing objects with complex values *(such as long strings)*, lots of properties, or collections of objects.
-
-`Approval tests` simplify this by taking a snapshot of the results, and confirming that they have not changed.
-
-In normal unit testing, you say `expect(person.getAge(), 5)`. Approvals allow you to do this when the thing that you want to assert is no longer a primitive but a complex object. For example, you can say, `Approvals.verify(person)`.
-
-I am writing an implementation of **[Approval Tests](https://approvaltests.com/)** in Dart. If anyone wants to help, please **[text](https://t.me/yelmuratoff)** me. 🙏
-
-Thanks to **[Richard Coutts](https://github.com/buttonsrtoys)** for special contributions to the `approval_tests_flutter` package.
-
-## Packages
-ApprovalTests is designed for two level: Dart and Flutter.
-
-| Package | Version | Description |
-| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
-| [approval_tests](https://github.com/approvals/ApprovalTests.Dart/tree/main/packages/approval_tests) | [](https://pub.dev/packages/approval_tests) | **Dart** package for approval testing of `unit` tests *(main)* |
-| [approval_tests_flutter](https://github.com/approvals/ApprovalTests.Dart/tree/main/packages/approval_tests_flutter) | [](https://pub.dev/packages/approval_tests_flutter) | **Flutter** package for approval testing of `widget`, `integration` tests |
-
-
-## 📋 How it works
-
-- The first run of the test automatically creates an `approved` file if there is no such file.
-- If the changed results match the `approved` file perfectly, the test passes.
-- If there's a difference, a `reporter` tool will highlight the mismatch and the test fails.
-- If the test is passed, the `received` file is deleted automatically. You can change this by changing the `deleteReceivedFile` value in `options`. If the test fails, the received file remains for analysis.
-
-Instead of writing:
-```dart
- testWidgets('home page', (WidgetTester tester) async {
- await tester.pumpWidget(const MyApp());
- await tester.pumpAndSettle();
-
- expect(find.text('You have pushed the button this many times:'), findsOneWidget);
- expect(find.text('0'), findsOneWidget);
- expect(find.byWidgetPredicate(
- (Widget widget) => widget is Text && widget.data == 'hello' &&
- widget.key == ValueKey('myKey'),
- ), findsOneWidget);
- expect(find.text('Approved Example'), findsOneWidget);
- });
-```
-
-Write this:
-```dart
- testWidgets('smoke test', (WidgetTester tester) async {
- await tester.pumpWidget(const MyApp());
- await tester.pumpAndSettle();
-
- await tester.approvalTest();
- });
-```
-
-Suppose you wanted to confirm that a page loaded with all the widget you expected. To do this,
-perform an approval test by calling `tester.approvalTest`, and give your test a suitable name:
-
-```dart
- testWidget('home page', () {
- await tester.pumpWidget(const MyApp());
- await tester.pumpAndSettle();
-
- await tester.approvalTest(description: 'all widgets load correctly');
- });
-```
-
-To include your project's custom widget types in your test, and to perform post-test checks, add
-calls to `Approved.setUpAll()` to your tests' `setUpAll` calls, like so:
-
-```dart
- main() {
- setUpAll(() {
- Approved.setUpAll();
- });
- }
-```
-## 📦 Installation
-
-Add the following to your `pubspec.yaml` file:
-
-```yaml
-dependencies:
- approval_tests_flutter: ^1.1.0
-```
-
-## 👀 Getting Started
-
-The best way to get started is to download and open the example project:
-* [Flutter example project](https://github.com/approvals/ApprovalTests.Dart/tree/main/examples/flutter_example)
-
-## 📚 How to use
-
-In order to use `Approval Tests`, the user needs to:
-
-1. Set up a test: This involves importing the Approval Tests library into your own code.
-
-2. Optionally, set up a reporter: Reporters are tools that highlight differences between approved and received files when a test fails. Although not necessary, they make it significantly easier to see what changes have caused a test to fail. The default reporter is the `CommandLineReporter`. You can also use the `DiffReporter` to compare the files in your IDE, and the `GitReporter` to see the differences in the `Git GUI`.
-
-3. Manage the `approved` file: When the test is run for the first time, an approved file is created automatically. This file will represent the expected outcome. Once the test results in a favorable outcome, the approved file should be updated to reflect these changes. A little bit below I wrote how to do it.
-
-This setup is useful because it shortens feedback loops, saving developers time by only highlighting what has been altered rather than requiring them to parse through their entire output to see what effect their changes had.
-
-### Approving Results
-
-Approving results just means saving the `.approved.txt` file with your desired results.
-
-We’ll provide more explanation in due course, but, briefly, here are the most common approaches to do this.
-
-#### • Via Diff Tool
-Most diff tools have the ability to move text from left to right, and save the result.
-How to use diff tools is just below, there is a `Comparator` class for that.
-
-#### • Via CLI command
-You can run the command in a terminal to review your files:
-```bash
-dart run approval_tests:review
-```
-After running the command, the files will be analyzed and you will be asked to choose one of the options:
-- `y` - Approve the received file.
-- `n` - Reject the received file.
-- `v`iew - View the differences between the received and approved files. After selecting `v` you will be asked which IDE you want to use to view the differences.
-
-#### • Via approveResult property
-If you want the result to be automatically saved after running the test, you need to use the `approveResult` property in `Options`:
-
-```dart
-void main() {
- test('test JSON object', () {
- final complexObject = {
- 'name': 'JsonTest',
- 'features': ['Testing', 'JSON'],
- 'version': 0.1,
- };
-
- Approvals.verifyAsJson(
- complexObject,
- options: const Options(
- approveResult: true,
- ),
- );
- });
-}
-```
-
-this will result in the following file
-`example_test.test_JSON_object.approved.txt`
-```txt
-{
- "name": "JsonTest",
- "features": [
- "Testing",
- "JSON"
- ],
- "version": 0.1
-}
-```
-
-#### • Via file rename
-You can just rename the `.received` file to `.approved`.
-
-### Reporters
-
-Reporters are the part of Approval Tests that launch diff tools when things do not match. They are the part of the system that makes it easy to see what has changed.
-
-There are several reporters available in the package:
-- `CommandLineReporter` - This is the default reporter, which will output the diff in the terminal.
-- `GitReporter` - This reporter will open the diff in the Git GUI.
-- `DiffReporter` - This reporter will open the Diff Tool in your IDE.
- - For Diff Reporter I using the default paths to the IDE, if something didn't work then you in the console see the expected correct path to the IDE and specify customDiffInfo. You can also contact me for help.
-
-
-
-
-To use `DiffReporter` you just need to add it to `options`:
-```dart
- options: const Options(
- reporter: const DiffReporter(),
- ),
-```
-
-
-

-

-
-
-
-## 📝 Examples
-
-I have provided a couple of small examples here to show you how to use the package.
-There are more examples in the `example` folder for you to explore. I will add more examples in the future.
-Inside, in the `gilded_rose` folder, there is an example of using `ApprovalTests` to test the legacy code of [Gilded Rose kata](https://github.com/emilybache/GildedRose-Refactoring-Kata).
-You can study it to understand how to use the package to test complex code.
-
-And the `verify_methods` folder has small examples of using different `ApprovalTests` methods for different cases.
-
-### JSON example
-With `verifyAsJson`, if you pass data models as `JsonItem`, with nested other models as `AnotherItem` and `SubItem`, then you need to add an `toJson` method to each model for the serialization to succeed.
-
-```dart
-void main() {
- const jsonItem = JsonItem(
- id: 1,
- name: "JsonItem",
- anotherItem: AnotherItem(id: 1, name: "AnotherItem"),
- subItem: SubItem(
- id: 1,
- name: "SubItem",
- anotherItems: [
- AnotherItem(id: 1, name: "AnotherItem 1"),
- AnotherItem(id: 2, name: "AnotherItem 2"),
- ],
- ),
- );
-
- test('verify model', () {
- Approvals.verifyAsJson(
- jsonItem,
- options: const Options(
- deleteReceivedFile:
- true, // Automatically delete the received file after the test.
- approveResult:
- true, // Approve the result automatically. You can remove this property after the approved file is created.
- ),
- );
- });
-}
-```
-
-
-this will result in the following file
-`verify_as_json_test.verify_model.approved.txt`
-
-```txt
-{
- "jsonItem": {
- "id": 1,
- "name": "JsonItem",
- "subItem": {
- "id": 1,
- "name": "SubItem",
- "anotherItems": [
- {
- "id": 1,
- "name": "AnotherItem 1"
- },
- {
- "id": 2,
- "name": "AnotherItem 2"
- }
- ]
- },
- "anotherItem": {
- "id": 1,
- "name": "AnotherItem"
- }
- }
-}
-```
-
-
-
-
-## ❓ Which File Artifacts to Exclude from Source Control
-You must add any `approved` files to your source control system. But `received` files can change with any run and should be ignored. For Git, add this to your `.gitignore`:
-
-```gitignore
-*.received.*
-```
-
-## ✉️ For More Information
-### Questions?
-Ask me on Telegram: [`@yelmuratoff`](https://t.me/yelmuratoff).
-Email: [`yelamanyelmuratov@gmail.com`](mailto:yelamanyelmuratov@gmail.com)
-
-### Video Tutorials
-- [Getting Started with ApprovalTests.Swift](https://qualitycoding.org/approvaltests-swift-getting-started/)
-- [How to Verify Objects (and Simplify TDD)](https://qualitycoding.org/approvaltests-swift-verify-objects/)
-- [Verify Arrays and See Simple, Clear Diffs](https://qualitycoding.org/verify-arrays-approvaltests-swift/)
-- [Write Parameterized Tests by Transforming Sequences](https://qualitycoding.org/parameterized-tests-approvaltests-swift/)
-- [Wrangle Legacy Code with Combination Approvals](https://qualitycoding.org/wrangle-legacy-code-combination-approvals/)
-
-You can also watch a series of short videos about [using ApprovalTests in .Net](https://www.youtube.com/playlist?list=PL0C32F89E8BBB5368) on YouTube.
-
-### Podcasts
-Prefer learning by listening? Then you might enjoy the following podcasts:
-
-- [Hanselminutes](https://www.hanselminutes.com/360/approval-tests-with-llewellyn-falco)
-- [Herding Code](https://www.developerfusion.com/media/122649/herding-code-117-llewellyn-falcon-on-approval-tests/)
-- [The Watir Podcast](https://watirpodcast.com/podcast-53/)
-
-## Coverage
-
-[](https://codecov.io/gh/approvals/ApprovalTests.Dart/branch/main)
-
-## 🤝 Contributing
-Show some 💙 and star the repo to support the project! 🙌
-The project is in the process of development and we invite you to contribute through pull requests and issue submissions. 👍
-We appreciate your support. 🫰
-
-
-
-
Thanks to all contributors of this package
-
-
-
-
-
diff --git a/packages/approval_tests_flutter/analysis_options.yaml b/packages/approval_tests_flutter/analysis_options.yaml
deleted file mode 100644
index e65daa9..0000000
--- a/packages/approval_tests_flutter/analysis_options.yaml
+++ /dev/null
@@ -1,116 +0,0 @@
-include: package:sizzle_lints/sizzle_lints.yaml
-
-analyzer:
- errors:
- comment_references: ignore
- depend_on_referenced_packages: ignore
- invalid_use_of_visible_for_testing_member: ignore
-linter:
- rules:
- public_member_api_docs: false
- lines_longer_than_80_chars: false
-
-dart_code_metrics:
- metrics:
- cyclomatic-complexity: 20
- rules:
- # Show potential errors
- - avoid-cascade-after-if-null
- - avoid-collection-methods-with-unrelated-types
- - avoid-duplicate-exports
- - avoid-dynamic
- - avoid-missing-enum-constant-in-map
- # - avoid-passing-async-when-sync-expected
- - avoid-throw-in-catch-block
- - avoid-unused-parameters
- # - avoid-unnecessary-type-assertions
- - avoid-unnecessary-type-casts
- - avoid-unrelated-type-assertions
- - avoid-unrelated-type-casts
- - no-empty-block
- - no-equal-then-else
- - prefer-correct-test-file-name
- # - prefer-match-file-name
- - prefer-return-await
- - avoid-self-assignment
- - avoid-self-compare
- # - avoid-shadowing
- - prefer-iterable-of
- - no-equal-switch-case
- - no-equal-conditions
- - avoid-equal-expressions
- - avoid-missed-calls
- - avoid-unnecessary-negations
- - avoid-unused-generics
- - function-always-returns-null
- - avoid-throw-objects-without-tostring
- # - avoid-unsafe-collection-methods
- - prefer-wildcard-pattern
- - no-equal-switch-expression-cases
- - avoid-future-tostring
- # - avoid-unassigned-late-fields-keyword
- - avoid-nested-futures
- - avoid-generics-shadowing
- - prefer-parentheses-with-if-null
- - no-equal-nested-conditions
- - avoid-shadowed-extension-methods
- - avoid-unnecessary-conditionals
- - avoid-double-slash-imports
- - avoid-map-keys-contains
- - prefer-correct-json-casts
- - avoid-duplicate-mixins
- # - avoid-nullable-interpolation
- - avoid-unused-instances
- - prefer-correct-for-loop-increment
- - prefer-public-exception-classes
- - avoid-uncaught-future-errors
- - always-remove-listener
- - avoid-unnecessary-setstate
- - check-for-equals-in-render-object-setters
- - consistent-update-render-object
- - use-setstate-synchronously
- - avoid-incomplete-copy-with
- - proper-super-calls
- - dispose-fields
- - avoid-empty-setstate
- - avoid-state-constructors
- - avoid-recursive-widget-calls
- - avoid-missing-image-alt
- - avoid-passing-self-as-argument
- - avoid-unnecessary-if
- - avoid-unconditional-break
- - avoid-referencing-discarded-variables
- # Enable with the next release
- # - avoid-unnecessary-late
- # - avoid-wildcard-cases-with-enums
- # - match-getter-setter-field-names
- # - avoid-accessing-collections-by-constant-index
-
- # Code simplification
- - avoid-redundant-async
- - avoid-redundant-else
- - avoid-unnecessary-nullable-return-type
- - avoid-redundant-pragma-inline
- - avoid-nested-records
- - avoid-redundant-positional-field-name
- - avoid-explicit-pattern-field-name
- - prefer-simpler-patterns-null-check
- - avoid-unnecessary-return
- - avoid-duplicate-patterns
- - avoid-keywords-in-wildcard-pattern
- - avoid-unnecessary-futures
- - avoid-unnecessary-reassignment
- - avoid-unnecessary-call
- - avoid-unnecessary-stateful-widgets
- - prefer-dedicated-media-query-methods
- - avoid-unnecessary-overrides-in-state
- - move-variable-closer-to-its-usage
- # - avoid-unnecessary-getter
- # - avoid-nullable-parameters-with-default-values
-
- # Style
- - prefer-trailing-comma
- - unnecessary-trailing-comma
- - prefer-declaring-const-constructor
- - prefer-single-widget-per-file:
- ignore-private-widgets: true
\ No newline at end of file
diff --git a/packages/approval_tests_flutter/lib/approval_tests_flutter.dart b/packages/approval_tests_flutter/lib/approval_tests_flutter.dart
deleted file mode 100644
index f9683c7..0000000
--- a/packages/approval_tests_flutter/lib/approval_tests_flutter.dart
+++ /dev/null
@@ -1,4 +0,0 @@
-library approved;
-
-export 'package:approval_tests/approval_tests.dart';
-export 'package:approval_tests_flutter/src/src.dart';
diff --git a/packages/approval_tests_flutter/lib/src/common.dart b/packages/approval_tests_flutter/lib/src/common.dart
deleted file mode 100644
index 6333b93..0000000
--- a/packages/approval_tests_flutter/lib/src/common.dart
+++ /dev/null
@@ -1,15 +0,0 @@
-import 'dart:io';
-
-/// [String] extension
-extension StringApprovedExtension on String {
- /// git diff complains when file doesn't end in newline. This getter ensures a string does.
- String get endWithNewline => endsWith('\n') ? this : '$this\n';
-}
-
-extension DirectoryApprovedExtension on Directory {
- Set filesWithExtension(String extension) {
- final fileSystemEntities = listSync()
- .where((entity) => entity is File && entity.path.endsWith(extension));
- return fileSystemEntities.whereType().toSet();
- }
-}
diff --git a/packages/approval_tests_flutter/lib/src/get_widget_names.dart b/packages/approval_tests_flutter/lib/src/get_widget_names.dart
deleted file mode 100644
index d298a88..0000000
--- a/packages/approval_tests_flutter/lib/src/get_widget_names.dart
+++ /dev/null
@@ -1,176 +0,0 @@
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:analyzer/dart/analysis/context_builder.dart';
-import 'package:analyzer/dart/analysis/context_locator.dart';
-import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:approval_tests/approval_tests.dart';
-import 'package:approval_tests_flutter/src/common.dart';
-
-final _widgetNamesDir = Directory(ApprovalTestsConstants.resourceLocalPath);
-final _widgetNamesPath = '${_widgetNamesDir.path}/class_names.txt';
-
-Future> getWidgetNames() async {
- final resultCompleter = Completer>();
-
- await isWidgetNamesFileFresh().then((isFileFresh) {
- if (isFileFresh) {
- readWidgetsFile(_widgetNamesPath).then((widgetNames) {
- resultCompleter.complete(widgetNames);
- });
- } else {
- final libPath = '${Directory.current.absolute.path}/lib';
- stdout
- .write("package:approved: searching for class names in $libPath...");
- extractWidgetNames(libPath).then((widgetsList) {
- if (!_widgetNamesDir.existsSync()) {
- _widgetNamesDir.createSync();
- }
- _widgetNamesDir.createSync();
- final widgetsFile = File(_widgetNamesPath);
- widgetsFile.createSync();
- const header = '''
-# This file was autogenerated by package:approved. Please do not edit.
-# Below is a list of class found in the project /lib folder.''';
- final widgetNamesString = widgetsList.join('\n').endWithNewline;
- widgetsFile.writeAsStringSync('$header\n$widgetNamesString');
- stdout.write('done\n');
- resultCompleter.complete(widgetsList);
- });
- }
- });
-
- return resultCompleter.future;
-}
-
-String loadWidgetNames() {
- late String result;
- final widgetNamesFile = File(_widgetNamesPath);
- if (widgetNamesFile.existsSync()) {
- result = widgetNamesFile.readAsStringSync();
- }
- return result;
-}
-
-/// Crawls the project and extracts widget names.
-Future> extractWidgetNames(String libPath) async {
- final completer = Completer>();
-
- final contextLocator = ContextLocator();
- final contextRoots = contextLocator.locateRoots(includedPaths: [libPath]);
-
- final contextBuilder = ContextBuilder();
- await getFlutterSdkPath().then((path) {
- final dartStr = '$path/bin/cache/dart-sdk';
- final analysisContext = contextBuilder.createContext(
- contextRoot: contextRoots.first,
- sdkPath: dartStr,
- );
-
- final classNames = {};
-
- // Traverse all files in the lib folder
- final libDirectory = Directory(libPath);
- final dartFiles = libDirectory.listSync(recursive: true).where(
- (file) =>
- file.path.endsWith('.dart') &&
- !file.path.contains('.g.dart') &&
- !file.path.contains('.freezed.dart'),
- );
-
- for (final file in dartFiles) {
- final analysisSession = analysisContext.currentSession;
- final parsedResult =
- analysisSession.getParsedUnit(file.path) as ParsedUnitResult;
-
- for (final compilationUnitMember in parsedResult.unit.declarations) {
- if (compilationUnitMember is ClassDeclaration) {
- final String name = compilationUnitMember.name.value().toString();
- if (!name.startsWith('_')) {
- classNames.add(name);
- }
- }
- }
- }
-
- completer.complete(classNames);
- });
-
- return completer.future;
-}
-
-/// Get the path to the Flutter SDK
-Future getFlutterSdkPath() async {
- final completer = Completer();
-
- await Process.run('flutter', ['--version', '--machine']).then((result) {
- if (result.exitCode != 0) {
- throw Exception('Failed to run flutter command: ${result.stderr}');
- }
-
- final jsonData =
- jsonDecode(result.stdout.toString()) as Map;
-
- completer.complete(jsonData['flutterRoot'].toString());
- });
-
- return completer.future;
-}
-
-Future> readWidgetsFile(String filePath) async {
- final completer = Completer>();
- final File file = File(filePath);
-
- await file.readAsString().then((text) {
- // Split by lines
- final linesList = text.split('\n');
- // Remove empty lines and comments
- final linesSet = linesList
- .where((line) => line.isNotEmpty && !line.startsWith('#'))
- .toSet();
- completer.complete(linesSet);
- });
-
- return completer.future;
-}
-
-Future isWidgetNamesFileFresh() async {
- final resultCompleter = Completer();
-
- final libDirectory = Directory('lib');
-
- await findNewestDartFileTimestamp(libDirectory).then((dateTime) {
- final widgetNamesFile = File(_widgetNamesPath);
- if (dateTime != null &&
- widgetNamesFile.existsSync() &&
- widgetNamesFile.lastModifiedSync().isAfter(dateTime)) {
- resultCompleter.complete(true);
- } else {
- resultCompleter.complete(false);
- }
- });
-
- return resultCompleter.future;
-}
-
-Future findNewestDartFileTimestamp(Directory dir) async {
- DateTime? newestTimestamp;
-
- if (!await dir.exists()) {
- return null;
- }
-
- await for (final FileSystemEntity entity in dir.list(recursive: true)) {
- if (entity is File && entity.path.endsWith('.dart')) {
- final DateTime lastModified = await entity.lastModified();
-
- if (newestTimestamp == null || lastModified.isAfter(newestTimestamp)) {
- newestTimestamp = lastModified;
- }
- }
- }
-
- return newestTimestamp;
-}
diff --git a/packages/approval_tests_flutter/lib/src/src.dart b/packages/approval_tests_flutter/lib/src/src.dart
deleted file mode 100644
index 4ea8571..0000000
--- a/packages/approval_tests_flutter/lib/src/src.dart
+++ /dev/null
@@ -1,119 +0,0 @@
-// ignore_for_file: avoid_print
-
-import 'dart:async';
-
-import 'package:approval_tests/approval_tests.dart';
-import 'package:approval_tests_flutter/src/get_widget_names.dart';
-import 'package:approval_tests_flutter/src/widget_meta/collect_widgets_meta_data.dart'
- as widgets_meta_data;
-import 'package:flutter_test/flutter_test.dart';
-
-Set? _widgetNames;
-
-class ApprovalWidgets {
- static const FilePathExtractor filePathExtractor =
- FilePathExtractor(stackTraceFetcher: StackTraceFetcher());
-
- /// Initializes the approval test by building a database of project classes.
- ///
- /// Typically called from within flutter_tests function 'setUpAll'
- static Future> setUpAll() async {
- final completer = Completer>();
- await getWidgetNames().then((value) {
- _widgetNames = value;
- completer.complete(value);
- });
- return completer.future;
- }
-
- static Set? get widgetNames => _widgetNames;
-}
-
-/// [_globalApprovalTest] resolves the name conflict with [WidgetTester.approvalTest]
-Future Function(String?, String, Options?) _globalApprovalTest =
- (description, value, options) async {
- Approvals.verify(
- value,
- options: options != null
- ? options.copyWith(
- scrubber: options.scrubber,
- approveResult: options.approveResult,
- comparator: options.comparator,
- reporter: options.reporter,
- deleteReceivedFile: options.deleteReceivedFile,
- namer: Namer(
- filePath: options.namer?.filePath,
- options: options.namer?.options,
- addTestName: options.namer?.addTestName ?? true,
- description: description,
- ),
- logErrors: options.logErrors,
- logResults: options.logResults,
- includeClassNameDuringSerialization:
- options.includeClassNameDuringSerialization,
- )
- : Options(
- namer: Namer(
- description: description,
- ),
- ),
- );
-};
-
-extension WidgetTesterApprovedExtension on WidgetTester {
- /// Returns the meta data for the widgets for comparison during the approval test
- Future get widgetsString async {
- final completer = Completer();
- assert(_widgetNames != null, '''
- Looks like Approved.initialize() was not called before running an approvalTest. Typically,
- this issue is solved by calling Approved.initialize() from within setUpAll:
-
- void setUpAll(() async {
- await Approved.initialize();
- });
-''');
-
- await widgets_meta_data
- .collectWidgetsMetaData(
- this,
- outputMeta: true,
- verbose: false,
- widgetNames: ApprovalWidgets.widgetNames,
- )
- .then((stringList) {
- completer.complete(stringList.join('\n'));
- });
-
- return completer.future;
- }
-
- /// Performs an approval test.
- ///
- /// [description] is the name of the test. It is appended to the description in [Tester].
- /// [textForReview] is the meta data text used in the approval test.
- Future approvalTest({
- String? description,
- String? textForReview,
- Options? options,
- }) async {
- final resultCompleter = Completer();
- final widgetsMetaCompleter = Completer();
-
- // If no text passed, then get the widget meta from the widget tree
- if (textForReview == null) {
- await widgetsString.then((value) {
- widgetsMetaCompleter.complete(value);
- });
- } else {
- widgetsMetaCompleter.complete(textForReview);
- }
- await widgetsMetaCompleter.future.then((value) {
- resultCompleter
- .complete(_globalApprovalTest(description, value, options));
- });
- return resultCompleter.future;
- }
-
- /// Output expect statements to the console.
- Future printExpects() => widgets_meta_data.printExpects(this);
-}
diff --git a/packages/approval_tests_flutter/lib/src/widget_meta/collect_widgets_meta_data.dart b/packages/approval_tests_flutter/lib/src/widget_meta/collect_widgets_meta_data.dart
deleted file mode 100644
index fabbc24..0000000
--- a/packages/approval_tests_flutter/lib/src/widget_meta/collect_widgets_meta_data.dart
+++ /dev/null
@@ -1,586 +0,0 @@
-import 'package:approval_tests/approval_tests.dart';
-import 'package:approval_tests_flutter/src/widget_meta/expect_meta.dart';
-import 'package:approval_tests_flutter/src/widget_meta/load_string_en.dart';
-import 'package:approval_tests_flutter/src/widget_meta/matcher_types.dart';
-import 'package:approval_tests_flutter/src/widget_meta/register_types.dart';
-import 'package:approval_tests_flutter/src/widget_meta/widget_meta.dart';
-import 'package:flutter/widgets.dart';
-import 'package:flutter_test/flutter_test.dart';
-
-Set registeredNames = {};
-
-const String instructions =
- '/// Replace your call to generateExpects with the code below.';
-List _previousWidgetMetas = [];
-List _previousExpectStrings = [];
-bool _isEnStringReverseLookupLoaded = false;
-bool _isCommonTypesLoaded = false;
-Map> _enStringReverseLookup = >{};
-
-/// Output widget tests to the console.
-///
-/// [widgetTypes] is a set of custom classes to generate expects for.
-/// [pathToStrings] is the path to a json file containing string constants. E.g., generated by the intl package.
-/// [silent] determines whether to suppress output to console.
-/// [compareWithPrevious] determines whether only changed tests from the previous run are displayed
-/// [verbose] determines whether the cut-and-paste tip is shown (should be false inside generated widgetTests)
-Future printExpects(
- WidgetTester tester, {
- Set? widgetTypes,
- Set? widgetNames,
- String? pathToStrings,
- bool silent = false,
- bool verbose = true,
- bool compareWithPrevious = true,
-}) async {
- final text = await collectWidgetsMetaData(
- tester,
- widgetTypes: widgetTypes,
- widgetNames: widgetNames,
- pathToStrings: pathToStrings,
- silent: silent,
- verbose: verbose,
- compareWithPrevious: compareWithPrevious,
- );
-
- _outputText(text);
-}
-
-Future _loadEnStringReverseLookupIfNecessary(String path) async {
- if (!_isEnStringReverseLookupLoaded) {
- _enStringReverseLookup = await loadEnStringReverseLookup(path);
- }
-}
-
-Future _loadCommonTypesIfNecessary(Set commonTypes) async {
- if (!_isCommonTypesLoaded) {
- registerTypes(commonTypes);
- _isCommonTypesLoaded = true;
- }
-}
-
-/// Manually adds text to the reverse lookup map (instead of loading from file).
-/// [markEnStringFileAsLoaded] as true blocks loads from file. This is primarily for testing.
-Future addTextToIntlReverseLookup({
- required String stringId,
- required String stringContent,
- bool markEnStringFileAsLoaded = true,
-}) async {
- if (markEnStringFileAsLoaded) {
- _isEnStringReverseLookupLoaded = true;
- }
-
- addToReverseLookup(
- reverseLookupMap: _enStringReverseLookup,
- stringId: stringId,
- stringContent: stringContent,
- );
-}
-
-/// Outputs widget meta data as an expect statement or as text.
-///
-/// [tester] is the tester passed from a flutter test. E.g., from within [testWidget]
-/// [widgetTypes] is a set of widget types to match and include in a test.
-/// [widgetNames] is a set of widget names to search for. (Specify [widgetTypes] or [widgetNames] but not both.
-/// [pathToStrings] is the path to a json file containing string constants. E.g., generated by the intl package.
-/// (This feature is currently not supported, but will be reinstated if requested.)
-/// [silent ] is true to suppress output to console and file (should be false inside generated widgetTests).
-/// [verbose] shows explanatory text that explains meta data.
-/// [compareWithPrevious ] is true to compare the current states with previous to display diffs.
-/// [outputExpects] is true to print expect statements to console.
-/// [outputMeta] is true to output data to an approval-test file.
-Future> collectWidgetsMetaData(
- WidgetTester tester, {
- Set? widgetTypes,
- Set? widgetNames,
- String? pathToStrings,
- bool silent = false,
- bool verbose = true,
- bool compareWithPrevious = true,
- bool? outputExpects,
- bool? outputMeta,
-}) async {
- assert(outputExpects == null || outputMeta == null);
-
- registeredNames = widgetNames ?? {};
-
- if (pathToStrings != null) {
- await _loadEnStringReverseLookupIfNecessary(pathToStrings);
- }
- if (widgetTypes != null) {
- await _loadCommonTypesIfNecessary(widgetTypes);
- }
-
- final text = [];
-
- if (!compareWithPrevious) {
- _previousWidgetMetas = [];
- _previousExpectStrings = [];
- }
-
- final widgets = _getWidgetsForExpects(tester, widgetNames ?? {});
-
- if (widgets.isEmpty) {
- text.add('No widgets found for approval testing.');
- } else {
- text.addAll(
- await _generateExpectsForWidgets(
- widgets,
- tester: tester,
- verbose: verbose,
- silent: silent,
- outputType:
- (outputMeta ?? false) ? OutputType.widgetMeta : OutputType.expects,
- ),
- );
- }
-
- return text;
-}
-
-Future> _generateExpectsForWidgets(
- List widgets, {
- required WidgetTester tester,
- required bool verbose,
- required bool silent,
- required OutputType outputType,
-}) async {
- final text = [];
-
- final currentWidgetMetas = _widgetMetasFromWidgets(widgets);
- final deltaWidgetMetas =
- _getDeltaWidgetMetas(currentWidgetMetas, _previousWidgetMetas);
- currentWidgetMetas.addAll(deltaWidgetMetas);
- final currentExpectStrings =
- _outputStringsFromWidgetMetas(currentWidgetMetas, outputType, verbose);
- final deltaExpectStrings =
- _getDeltaExpectStrings(currentExpectStrings, _previousExpectStrings);
-
- if (!silent) {
- if (deltaExpectStrings.isEmpty) {
- if (_previousWidgetMetas.isEmpty) {
- text.add('/// No widget with keys or custom types found to test');
- } else {
- text.add(
- "/// No changes to widget with keys or custom types since the prior call to 'generateExpects'",
- );
- }
- } else {
- if (verbose && outputType == OutputType.expects) {
- text.add(instructions);
- }
- text.addAll(deltaExpectStrings);
- }
- }
-
- _previousWidgetMetas = currentWidgetMetas;
- _previousExpectStrings = currentExpectStrings;
-
- return text;
-}
-
-List _getDeltaExpectStrings(
- List currentExpectStrings,
- List previousExpectStrings,
-) {
- final deltaExpectStrings = currentExpectStrings
- .where((item) => !previousExpectStrings.contains(item))
- .toList();
-
- return deltaExpectStrings;
-}
-
-/// Convert Widgets into [WidgetMeta]s
-///
-/// Result contains no duplicates (because duplicate [WidgetMeta]s result in duplicate generated tests
-List _widgetMetasFromWidgets(List widgets) {
- final widgetMetas = [];
-
- for (final widget in widgets) {
- // Ignore widgets Flutter adds with prefixes (e.g., "[key <")
- if (widget.key == null || _isProperlyFormattedKey(widget)) {
- final widgetMeta = WidgetMeta(widget: widget);
- if (!widgetMetas.contains(widgetMeta)) {
- widgetMetas.add(widgetMeta);
- }
- }
- }
-
- return widgetMetas;
-}
-
-bool _isProperlyFormattedKey(Widget widget) =>
- widget.key.toString().indexOf('[<') == 0;
-
-/// The order to output expects
-enum _ExpectTypeOrder {
- noText,
- intlText,
- nonIntlText,
-}
-
-enum OutputType {
- expects,
- widgetMeta;
-}
-
-/// Generates expect() strings from [WidgetMeta]s. Sorts strings in order of [_ExpectTypeOrder]
-List _outputStringsFromWidgetMetas(
- List widgetMetas,
- OutputType outputType,
- bool verbose,
-) {
- final expectMetas = [];
- final result = [];
-
- for (final widgetMeta in widgetMetas) {
- final expectMetaFromWidgetMeta = _expectMetaFromWidgetMeta(widgetMeta);
- expectMetas.add(expectMetaFromWidgetMeta);
- }
-
- int sortOrder(ExpectMeta expectMeta) {
- _ExpectTypeOrder result = _ExpectTypeOrder.noText;
- if (expectMeta.widgetMeta.hasText) {
- result = _ExpectTypeOrder.intlText;
- if (!expectMeta.isIntl) {
- result = _ExpectTypeOrder.nonIntlText;
- }
- }
- return result.index;
- }
-
- expectMetas.sort((a, b) => sortOrder(a).compareTo(sortOrder(b)));
-
- bool generatedNonIntlTextComment = false;
-
- for (final expectMeta in expectMetas) {
- if (!generatedNonIntlTextComment && sortOrder(expectMeta) == 2) {
- generatedNonIntlTextComment = true;
- if (verbose) {
- result.add(
- '\t// No reverse lookup found for the text in the expect statements below',
- );
- }
- }
-
- late final List expectStringsFromWidgetMeta;
- if (outputType == OutputType.expects) {
- expectStringsFromWidgetMeta = _expectStringsFromExpectMeta(expectMeta);
- } else if (outputType == OutputType.widgetMeta) {
- expectStringsFromWidgetMeta = _metaStringsFromExpectMeta(expectMeta);
- }
-
- result.addAll(expectStringsFromWidgetMeta);
- }
-
- return result;
-}
-
-void _outputText(List strings) {
- for (final expectString in strings) {
- ApprovalLogger.log('\t$expectString');
- }
-}
-
-List _getDeltaWidgetMetas(
- List currentWidgetMetas,
- List previousWidgetMetas,
-) {
- final deltaPreviousWidgetMetas = previousWidgetMetas
- .where((item) => !currentWidgetMetas.contains(item))
- .toList();
-
- // Matchers may have changed for the previous tests (e.g., findsOneWidget may now be findNothing), so update
- final updatedDeltaPreviousWidgetMetas = deltaPreviousWidgetMetas
- .map((widgetMeta) => WidgetMeta(widget: widgetMeta.widget))
- .toList();
-
- return updatedDeltaPreviousWidgetMetas;
-}
-
-/// Get all the widgets of interest for testing (e.g., has keys, has text, is registered)
-///
-/// Traverses the widget testing tree to build a list of widgets for testing.
-///
-/// The returned list is in no particular order.
-List _getWidgetsForExpects(
- WidgetTester tester,
- Set widgetNames,
-) {
- final widgets = [];
-
- bool isEmptyTextWidget(Widget widget) {
- final bool result;
- if (widget is Text && (widget.data == null || widget.data == '')) {
- result = true;
- } else {
- result = false;
- }
- return result;
- }
-
- bool isWidgetForExpect(Widget widget) {
- final bool result;
- if (isEmptyTextWidget(widget)) {
- result = false;
- } else {
- result = (widget.key != null &&
- (widget.key.toString().isCustomString ||
- widget.key.toString().isEnumString)) ||
- registeredTypes.contains(widget.runtimeType) ||
- widgetNames.contains(widget.runtimeType.toString()) ||
- WidgetMeta.isTextEnabled(widget);
- }
- return result;
- }
-
- for (final widget in tester.allWidgets) {
- if (isWidgetForExpect(widget)) {
- widgets.add(widget);
- }
- }
-
- return widgets;
-}
-
-List _expectStringsFromExpectMeta(ExpectMeta expectMeta) {
- final expects = [];
-
- // Number of attributes (e.g., Type, key, text) to match in expect
- final int attributesToMatchCount =
- (expectMeta.widgetMeta.keyString.isNotEmpty ? 1 : 0) +
- (expectMeta.widgetMeta.widgetText.isNotEmpty ? 1 : 0) +
- (expectMeta.widgetMeta.isWidgetTypeRegistered ? 1 : 0);
-
- if (attributesToMatchCount >= 1) {
- if (_haveEnString(expectMeta.widgetMeta.widgetText) ||
- attributesToMatchCount >= 2) {
- expects.addAll(
- _generateExpectWidgets(
- expectMeta.widgetMeta,
- attributesToMatchCount,
- ),
- );
- } else {
- expects.add(_generateExpect(expectMeta.widgetMeta));
- }
- }
-
- return expects;
-}
-
-List _metaStringsFromExpectMeta(ExpectMeta expectMeta) {
- final expects = [];
-
- expects.add(_generateWidgetMeta(expectMeta.widgetMeta));
-
- return expects;
-}
-
-String _generateExpect(WidgetMeta widgetMeta) {
- late final String generatedExpect;
-
- if (widgetMeta.keyString.isNotEmpty) {
- if (widgetMeta.keyType == KeyType.enumValue) {
- generatedExpect =
- '\texpect(find.byKey(const ValueKey(${widgetMeta.keyString})), ${widgetMeta.matcherType.matcherName});';
- } else if (widgetMeta.keyType == KeyType.stringValueKey) {
- generatedExpect =
- '\texpect(find.byKey(${widgetMeta.keyString}), ${widgetMeta.matcherType.matcherName});';
- } else {
- throw Exception('Unexpected keyType');
- }
- } else if (widgetMeta.widgetText.isNotEmpty) {
- generatedExpect =
- "\texpect(find.text('${widgetMeta.widgetText}'), ${widgetMeta.matcherType.matcherName});";
- } else if (widgetMeta.isWidgetTypeRegistered) {
- generatedExpect =
- '\texpect(find.byType(${widgetMeta.widgetType}), ${widgetMeta.matcherType.matcherName});';
- } else {
- generatedExpect = '(Internal error. Expect not generated.)';
- }
-
- return generatedExpect;
-}
-
-ExpectMeta _expectMetaFromWidgetMeta(WidgetMeta widgetMeta) {
- final expectMeta = ExpectMeta(widgetMeta: widgetMeta);
-
- if (widgetMeta.widgetText.isNotEmpty) {
- if (_haveEnString(widgetMeta.widgetText)) {
- expectMeta.intlKeys = _enStringReverseLookup[widgetMeta.widgetText];
- }
- }
-
- return expectMeta;
-}
-
-List _generateExpectWidgets(
- WidgetMeta widgetMeta,
- int attributesToMatch,
-) {
- final buffer = StringBuffer();
- const intlPlaceHolder = '__INTL_PLACE_HOLDER__';
- List? intlKeys;
- int attributesWrittenToBuffer = 0;
-
- void addTextAttributeToBuffer() {
- if (_haveEnString(widgetMeta.widgetText)) {
- intlKeys = _enStringReverseLookup[widgetMeta.widgetText];
- if (intlKeys != null) {
- buffer.write("intl: (s) => s.$intlPlaceHolder");
- }
- } else {
- buffer.write("data: '${widgetMeta.widgetText}'");
- }
- }
-
- void addTypeAttributeToBuffer() {
- buffer.write('widgetType: ${widgetMeta.widgetType}');
- }
-
- void addKeyAttributeToBuffer() {
- buffer.write("key: ${widgetMeta.keyString}");
- }
-
- void addMatcherAttributeToBuffer() {
- buffer.write(', matcher: ${widgetMeta.matcherType.matcherName},');
- }
-
- bool haveMoreAttributesToProcess() =>
- ++attributesWrittenToBuffer < attributesToMatch;
-
- buffer.write('\ttester.expectWidget(');
-
- if (widgetMeta.widgetText.isNotEmpty) {
- addTextAttributeToBuffer();
- if (haveMoreAttributesToProcess()) {
- buffer.write(', ');
- }
- }
-
- if (widgetMeta.isWidgetTypeRegistered) {
- addTypeAttributeToBuffer();
- if (haveMoreAttributesToProcess()) {
- buffer.write(', ');
- }
- }
-
- if (widgetMeta.keyString.isNotEmpty) {
- addKeyAttributeToBuffer();
- }
-
- if (widgetMeta.matcherType.matcher != findsOneWidget) {
- addMatcherAttributeToBuffer();
- }
-
- buffer.write(');');
-
- final result = [];
-
- if (intlKeys == null) {
- result.add(buffer.toString());
- } else {
- final bufferString = buffer.toString();
- if (intlKeys!.length > 1) {
- result.add(
- '\t// Multiple matches for "${widgetMeta.widgetText}" in string_en.json. Pick one.',
- );
- }
- for (final intlKey in intlKeys!) {
- result.add(bufferString.replaceAll(intlPlaceHolder, intlKey));
- }
- if (intlKeys!.length > 1) {
- result.add('\t// (End of matches)');
- }
- }
-
- return result;
-}
-
-String _generateWidgetMeta(
- WidgetMeta widgetMeta,
-) {
- final buffer = StringBuffer();
- bool isFirstAttribute = true;
-
- void addCommaIfNecessary() {
- if (isFirstAttribute) {
- isFirstAttribute = false;
- } else {
- buffer.write(', ');
- }
- }
-
- void addTextAttributeToBuffer() {
- addCommaIfNecessary();
- buffer.write("data: '${widgetMeta.widgetText}'");
- }
-
- void addKeyAttributeToBuffer() {
- addCommaIfNecessary();
- buffer.write("key: ${widgetMeta.keyString}");
- }
-
- void addMatcherAttributeToBuffer() {
- addCommaIfNecessary();
- buffer.write('count: ');
- if (widgetMeta.matcherType == MatcherTypes.findsNothing) {
- buffer.write('0');
- } else if (widgetMeta.matcherType == MatcherTypes.findsOneWidget) {
- buffer.write('1');
- } else if (widgetMeta.matcherType == MatcherTypes.findsWidgets) {
- buffer.write('many');
- }
- }
-
- buffer.write('${widgetMeta.widgetType}: {');
-
- if (widgetMeta.keyString.isNotEmpty) {
- addKeyAttributeToBuffer();
- }
-
- if (widgetMeta.widgetText.isNotEmpty) {
- addTextAttributeToBuffer();
- }
-
- addMatcherAttributeToBuffer();
-
- buffer.write('}');
-
- final result = buffer.toString();
-
- return result;
-}
-
-bool _haveEnString(dynamic key) => _enStringReverseLookup.containsKey(key);
-
-/// Meta data for gestures
-/// Per EWP-1519, this is a work in progress
-class _GestureMeta {
- _GestureMeta(this.keyword, this.gestureCallbackName);
-
- String keyword;
- String gestureCallbackName;
-
- static List<_GestureMeta> get all => <_GestureMeta>[
- _GestureMeta('button', 'onTap'),
- _GestureMeta('toggle', 'onTap'),
- ];
-}
-
-/// Get the gesture associated with the widget key name. E.g., [keyName] containing "button" returns "tap"
-String? getGesture(String keyName) {
- String? gestureName;
-
- if (keyName.isNotEmpty) {
- final keyNameLowerCase = keyName.toLowerCase();
- for (final gestureMeta in _GestureMeta.all) {
- if (keyNameLowerCase.contains(gestureMeta.keyword)) {
- gestureName = gestureMeta.gestureCallbackName;
- }
- }
- }
-
- return gestureName;
-}
diff --git a/packages/approval_tests_flutter/lib/src/widget_meta/expect_meta.dart b/packages/approval_tests_flutter/lib/src/widget_meta/expect_meta.dart
deleted file mode 100644
index 979742d..0000000
--- a/packages/approval_tests_flutter/lib/src/widget_meta/expect_meta.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-import 'package:approval_tests_flutter/src/widget_meta/widget_meta.dart';
-
-/// Meta data for generating an expect() statement
-class ExpectMeta {
- ExpectMeta({required this.widgetMeta});
-
- /// Keys found in string_en.json
- List? intlKeys;
-
- /// The [WidgetMeta] instance associated with this instance (1-to-1)
- final WidgetMeta widgetMeta;
-
- /// True if entry in string_en.json found
- bool get isIntl => intlKeys != null;
-
- /// True if multiple entries in string_en.json found
- bool get hasMultipleIntlKeys => isIntl && intlKeys!.length > 1;
-}
diff --git a/packages/approval_tests_flutter/lib/src/widget_meta/load_string_en.dart b/packages/approval_tests_flutter/lib/src/widget_meta/load_string_en.dart
deleted file mode 100644
index b3de9e0..0000000
--- a/packages/approval_tests_flutter/lib/src/widget_meta/load_string_en.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-// ignore: prefer_expression_function_bodies
-Future