Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance: Expand Receipt Search Functionality and Add Unit Tests #400

Merged
merged 4 commits into from
Jun 7, 2024

Conversation

artkolpakov
Copy link
Contributor

Description

This pull request addresses the issue raised regarding the limited functionality of the receipt search feature in the receipt management dashboard UI (/dashboard/receipts/). The following enhancements and additions have been made to improve the receipt search functionality:

1. Expand Receipt Search Functionality

  • Updated the receipt fetch search query to include additional fields such as merchant_store, purchase_category, and id.
  • Conducted functional testing to confirm that the receipt search functionality has now been expanded to include searching by receipt ID, merchant/store, and category.
  • Previously, the search functionality only filtered by name and date. The updated implementation provides a more comprehensive receipt search.

2. Add Comprehensive Unit Tests for Receipt Search Functionality

  • Introduced two test_search_functionality unit tests in the views and api test folders' test_receipts.py files.
  • These tests cover various receipt search scenarios, including exact field matches, substring matches, case insensitivity, empty queries, and nonexistent queries.
  • Previously, the receipt search functionality lacked any testing coverage.

Overall, these changes aim to improve the test coverage, usability and effectiveness of the receipt search feature, providing users with more flexibility and accuracy when searching for receipts based on specific receipt attributes.

Checklist

  • Ran the Black Formatter and
    djLint-er on any new code
    (checks
    will
    fail without)
  • Made any changes or additions to the documentation where required
  • Changes generate no new warnings/errors
  • New and existing unit tests pass locally with my
    changes

What type of PR is this?

  • ✨ Feature
  • 🐛 Bug Fix

Added/updated tests?

  • 👍 yes

Related PRs, Issues etc

artkolpakov and others added 3 commits June 4, 2024 14:12
Enhanced the receipt fetch search query to include additional fields. Updated the search logic to filter results by `merchant_store`, `purchase_category`, and `id`. Previously, the search functionality only filtered by `name` and `date`. The updated implementation provides a more comprehensive receipt search.
This commit introduces unit tests for the receipt search functionality performed via the receipts management dashboard. Specifically, this commit adds two `test_search_functionality` unit tests in the `views` and `api` test folders' `test_receipts.py` files to test various search queries, ensuring the receipt search feature works correctly across various scenarios, including exact matches, substring matches, case insensitivity, empty queries, and nonexistent queries.
@artkolpakov
Copy link
Contributor Author

@TreyWW it seems that the check for typos is failing because some of my substring test search queries contain partial words (e.g., "Fo" to match receipts with the "Food" purchase category). I'm unsure whether I should adjust this or if it's acceptable to overlook this check for the purpose of my unit tests. Thanks for taking your time to review the PR 🙏

@TreyWW
Copy link
Owner

TreyWW commented Jun 5, 2024

Hey @artkolpakov, amazing PR by the way! You coulnadd the test files to extend-exclude = ["/bundle.js", "/bundle.js.map"] in typos.toml, and just ignore the whole test case if you want

Slightly readjusted receipt search unit test query substrings to pass the `typos` grammar check.
@artkolpakov
Copy link
Contributor Author

Hey @artkolpakov, amazing PR by the way! You coulnadd the test files to extend-exclude = ["/bundle.js", "/bundle.js.map"] in typos.toml, and just ignore the whole test case if you want

Thank you! I found a slightly cleaner solution (I simply re-adjusted the substrings in my unit tests to pass the typos check), and all the checks should be passing now.

@TreyWW TreyWW merged commit 583dfd0 into TreyWW:main Jun 7, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: receipt search functionality does not support searching by receipt ID, merchant/store, and category
2 participants