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 #12

Open
ivnvxd opened this issue Oct 5, 2024 · 0 comments
Open

Add Unit Tests #12

ivnvxd opened this issue Oct 5, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@ivnvxd
Copy link
Owner

ivnvxd commented Oct 5, 2024

Description

We need to implement unit tests for our Arc Pinned Tabs to HTML Bookmarks Converter project to ensure code reliability and maintainability. Currently, the project lacks a comprehensive test suite, which makes it difficult to verify the correctness of individual functions and catch potential regressions when making changes.

Objectives

  1. Set up a testing framework (e.g., pytest)
  2. Create test cases for each main function in main.py
  3. Implement mock objects for file system and subprocess operations
  4. Ensure good test coverage for critical parts of the code

Proposed Test Cases

1. Test setup_logging function

  • Verify that logging is properly configured with different verbosity levels

2. Test get_version function

  • Mock subprocess calls and verify correct parsing of git output
  • Test error handling when git commands fail

3. Test read_json function

  • Mock file system operations to test both successful and failed JSON reading
  • Verify correct handling of different file locations (current directory vs. Arc Browser directory)

4. Test convert_json_to_html function

  • Provide sample JSON input and verify correct HTML output
  • Test edge cases (empty input, malformed JSON, etc.)

5. Test get_spaces function

  • Verify correct parsing of space information from JSON input
  • Test handling of pinned and unpinned spaces

6. Test convert_to_bookmarks function

  • Verify correct conversion of spaces and items to bookmark structure
  • Test nested folder structures and various item types

7. Test convert_bookmarks_to_html function

  • Verify correct HTML generation from bookmark structure
  • Test proper indentation and nesting of HTML elements

8. Test write_html function

  • Mock file system operations to verify correct file writing
  • Test both specified and default output file naming

9. Test main function and argument parsing

  • Verify correct behavior with different command-line arguments
  • Test error handling for invalid inputs

Additional Tasks

  • Set up GitHub Actions for continuous integration to run tests automatically on push and pull requests
  • Add code coverage reporting to identify areas that need more testing

Acceptance Criteria

  • All proposed test cases are implemented and passing
  • Test coverage is at least 80% for critical functions
  • CI pipeline is set up and running tests automatically
  • README is updated with instructions on how to run tests

Resources

@ivnvxd ivnvxd added enhancement New feature or request good first issue Good for newcomers hacktoberfest labels Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant