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

Hashtag parsing tests for various inputs #1727

Merged
merged 3 commits into from
Aug 5, 2024

Conversation

azharcodeit
Copy link
Collaborator

@azharcodeit azharcodeit commented Aug 1, 2024

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Related Issue

Related to Issue #1613

Describe this PR

Context:

We accept a string input for hashtags, with some parsing to ensure they are always in hashtag format.

For example:

  • tag1, tag2, tag3
  • tag1 tag2 tag3
  • tag1 tag2 tag3
  • tag1, tag2 tag3 tag4
  • TAG1, tag2 TAG3

Any other random assortment the user could provide!

In the end, the project details response should return an array of hashtags:

  • ['#tag1', '#tag2', '#tag3']

What was done:

This PR tests hashtag parsing with various edge cases. Adjusts expected outputs in tests to reflect correct hashtag processing.

Screenshots

Screenshot 2024-08-05 at 13 07 18

Alternative Approaches Considered

Review Guide

Command to run all tests defined in the project using pytest:

docker compose run --rm api pytest

Checklist before requesting a review

[optional] What gif best describes this PR or how it makes you feel?

@azharcodeit azharcodeit force-pushed the feat/test-hashtag-format branch from b260d03 to aca12cf Compare August 5, 2024 12:12
@azharcodeit azharcodeit changed the title Enhance hashtag validation and test for various inputs Hashtag parsing tests for various inputs Aug 5, 2024
@azharcodeit
Copy link
Collaborator Author

@spwoodcock, please have a look.

Reduced test cases for hashtags;
Kept the initial hashtag validation since there's no need to convert tags to lowercase, and the FMTM tag should remain in uppercase.

@spwoodcock spwoodcock merged commit 2714194 into hotosm:development Aug 5, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code tests Related to automated code tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants