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

Add unit tests for Client Search functionality #370

Merged
merged 3 commits into from
May 17, 2024
Merged

Conversation

artkolpakov
Copy link
Contributor

Description

This PR introduces unit tests for the client search functionality performed via the clients dashboard.

  • Added test_search_functionality in tests/views/test_clients.py:

    • Tests various search queries to ensure correct client filtering.
    • Handles exact matches, substring matches, case insensitivity, empty queries, and nonexistent queries.
    • For each test search query, a GET request is made to the clients API endpoint with the search parameter.
    • The test asserts that the number of returned clients matches the expected number of clients and that each expected client is present in the returned clients list, ensuring that the search functionality works as intended.
  • Added test_search_functionality in tests/api/test_clients.py:

    • Verifies the API's response to different search queries.
    • Ensures correct filtering based on client name, email, and ID, including partial matches and empty queries.
    • Validates that the returned clients match the expected results for each query scenario.

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?

  • ✨ Unit test enhancement

Added/updated tests?

  • 👍 yes

Related PRs, Issues etc

N/A

artkolpakov and others added 3 commits May 16, 2024 12:27
This commit introduces unit tests for the client search functionality performed via the clients dashboard. Specifically, this commit adds two `test_search_functionality` unit tests in the `views` and `api` test folders' `test_clients.py` files to test various search queries, ensuring correct client filtering.
Copy link
Owner

@TreyWW TreyWW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing PR, thank you so much! 💜

@TreyWW TreyWW merged commit fa5b949 into TreyWW:main May 17, 2024
11 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.

2 participants