community icon indicating copy to clipboard operation
community copied to clipboard

basic testing for automation

Open derberg opened this issue 10 months ago • 4 comments

  • in README.md at the bottom add new section Development and explain that in community repo there is a lot of automation with custom scripts that need proper testing and that this section explains how to run tests and how to add new tests.
  • add package.json, package-lock.json - really simplistic, with only test script to run tests. Add jest as test runner
  • add new folder testing with first simple test. The test file name should referr to https://github.com/asyncapi/community/blob/master/.github/scripts/vote_tracker.js as all tests for that script will be in that file
  • refactor https://github.com/asyncapi/community/blob/master/.github/scripts/vote_tracker.js so isVotingWithinLastThreeMonths becomes a separate function that can be imported to test file and tested with unit tests
  • mock data for unit tests is already there. Before I added some console log to the script, so in https://github.com/asyncapi/community/actions/runs/13783797336/job/38547070311 you have examples of voteInfo like for example:
    {
    "name": "derberg",
    "Budget 2025$$1681": "In favor",
    "2024 budget refresh and request for urgent pre-approval of some 2025 costs$$1598": "In favor",
    "Should AsyncAPI Initiative endorse United Nations Global Digital Compact?$$1577": "In favor",
    "Donate kotlin-asyncapi$$1313": "In favor",
    "Proposal for Admin Rights for CoC Main Committee on Slack$$[1227](https://github.com/asyncapi/community/actions/runs/13783797336/job/38547070311#step:4:1228)": "In favor",
    "chore: add Marketing WORKING_GROUP$$1130": "In favor",
    "docs: add instruction how voting automation works$$1155": "In favor",
    "lastParticipatedVoteTime": "2025-02-20",
    "isVotedInLast3Months": true,
    "lastVoteClosedTime": "2025-03-11",
    "firstVoteClosedTime": "2024-04-12",
    "agreeCount": 7,
    "disagreeCount": 0,
    "abstainCount": 0,
    "notParticipatingCount": 0
    }
    
    so you can grab it, and modify as you wish inside tests to cover all the test cases

This is a minimal scope to make the review of a PR easier and faster

derberg avatar Mar 12 '25 09:03 derberg

@Nandgopal-R this is the issue you can work on, that I mentioned in https://github.com/asyncapi/community/pull/1776

derberg avatar Mar 12 '25 09:03 derberg

@Nandgopal-R this is the issue you can work on, that I mentioned in #1776

Sure, I will begin working on this

Nandgopal-R avatar Mar 12 '25 10:03 Nandgopal-R

@Nandgopal-R any progress?

derberg avatar Mar 25 '25 11:03 derberg

I became slightly busy due to exams, will put in a pr this week.

Nandgopal-R avatar Mar 25 '25 12:03 Nandgopal-R