Skip to content

test: add testing for isVotingWithinLastThreeMonths function #1837

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Nandgopal-R
Copy link
Contributor

Desciption

  • This PR brings in basic testing for automation and fixes a bug in the vote tracking logic.

Tests Introduced

  • Added Jest-based test cases to improve automation reliability for the isVotingWithinLastThreeMonths.
  • Covered various edge cases, including boundary conditions, invalid inputs, and real-world scenarios.

Fixes

  • Fixed the isVotingWithinLastThreeMonths to correctly handle future dates given in lastVoteDate.

How to test

  • Run npm test to execute all test cases.
  • Verify that all edge cases pass and invalid scenarios are correctly rejected.

This PR is related to issue #1786

@Nandgopal-R Nandgopal-R changed the title test: Add testing for isVotingWithinLastThreeMonths function test: add testing for isVotingWithinLastThreeMonths function Mar 31, 2025
Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

  • sorry, please rename testing to test to follow standard naming - I don't know why I suggested testing initially 😄
  • you forgot to add docs (first bullet point in requirements)
  • provide jsdoc for isVotingWithinLastThreeMonths and put there an example of voteInfo argument
  • I think that instead of vote_tracker_utils.js we should rather add there a new folder, as we already have some, like maintainers
    - .github
        - scripts
           - vote_tracker
               - index.js (previously `vote_tracker.js`)
               - utils.js 
    

wdyt?

@Nandgopal-R
Copy link
Contributor Author

I thought of this:

.github  
└── scripts  
    ├── vote_tracker  
    │   ├── index.js  # Main vote tracking logic  
    ├── vote_utils  
    │   ├── utils.js  # Utility functions for vote tracking  

This way, the core logic and utilities are separate. What do you think?

@Nandgopal-R Nandgopal-R requested a review from derberg April 4, 2025 17:33
@derberg
Copy link
Member

derberg commented Apr 7, 2025

but it ain't a big project, so does it make sense to introduce such folder structure? especially that scripts is more thatn vote tracking

@Nandgopal-R
Copy link
Contributor Author

but it ain't a big project, so does it make sense to introduce such folder structure? especially that scripts is more thatn vote tracking

Yeah, fair point. I'll follow the other one and keep it simple. And by the way, I have added the jsdoc and the Development segment to the readme in the previous PR

@derberg
Copy link
Member

derberg commented Apr 14, 2025

ping me whenever ready for another review round

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