shardeum/shardeum-validator-cli

Implement Unit Tests for Validator-CLI Commands

Open

#31 opened on Oct 9, 2024

View on GitHub
 (6 comments) (0 reactions) (0 assignees)TypeScript (12 forks)auto 404
good first issuehacktoberfesthelp wanted

Repository metrics

Stars
 (51 stars)
PR merge metrics
 (PR metrics pending)

Description

The validator-cli contains several important commands in the src/node-commands.ts file, but currently lacks comprehensive unit tests. Adding tests for these commands will significantly improve the reliability and maintainability of the CLI.

Proposed Solution

Implement unit tests for all the commands in the src/node-commands.ts file, covering various scenarios and edge cases.

Expected Outcome

After implementing your solution:

  • All commands in src/node-commands.ts should have corresponding unit tests
  • Test coverage should be high (aim for >80%)
  • Tests should cover successful executions, error handling, and edge cases
  • The codebase will be more reliable and easier to maintain
  • Potential bugs will be caught before reaching production

Getting Started

  • Fork the repository
  • Clone your fork: git clone [your-fork-url]
  • Create a new branch: git checkout -b feature/add-unit-tests
  • Create a new test file: src/tests/node-commands.test.ts
  • Implement unit tests for each command in src/node-commands.ts, including but not limited to: start,stop,status,info,stake,unstake,version,update,gui,clean
  • Run tests and ensure they pass
  • Commit your changes: git commit -m "Add unit tests for operator-cli commands"
  • Push to your fork: git push origin feature/add-unit-tests
  • Create a pull request

Mentorship

If you need any help or have questions about implementing the tests, feel free to ask in the comments. You can also start a discussion here on GitHub, and our team will be happy to provide the necessary assistance.

Contributor guide