Skip to content

Conversation

@nitishagar
Copy link

This PR introduces a complete testing infrastructure for the cloud-api project, including the Vitest testing framework, initial test coverage, CI integration, and documentation.

Context

While working on #7 (which introduces URL validation for the returnTo parameter to prevent open-redirect vulnerabilities), I noticed the related code doesn’t have unit test coverage. I may be missing something if this is covered in another repository, but I couldn’t find anything at the moment.

Changes

This PR establishes a testing foundation for the project:

  • Testing Framework Setup

    • Install Vitest v4.0.12 with UI and coverage support
    • Configure vitest.config.ts with Node.js environment and coverage settings
    • Add test scripts: test, test:watch, test:ui, test:coverage
  • Initial Test Coverage

    • Add unit tests for error classes (errors.test.ts - 9 tests)
    • Add unit tests for helper functions (helpers.test.ts - 12 tests)
    • Add comprehensive tests for releases API rollout logic (releases.test.ts - 18 tests)
  • CI/CD Integration

    • Add test execution step to GitHub Actions PR workflow
    • Tests run automatically on every pull request
  • Documentation

    • Add comprehensive Testing section to README.md
    • Document test commands, writing guidelines, and coverage reporting
    • Include examples and best practices
  • Project Configuration

    • Update .gitignore for coverage and Vitest cache directories
    • Update tsconfig.json for test file compilation

I would love feedback on the approach, and would like to make this part of PR review cycle.

Add Vitest as the testing framework with comprehensive test coverage:
- Install Vitest v4.0.12 with UI and coverage support
- Configure test scripts (test, test:watch, test:ui, test:coverage)
- Add unit tests for error classes (9 tests)
- Add unit tests for helper functions (12 tests)
- Add comprehensive tests for releases API rollout logic (18 tests)
- Update README with detailed testing documentation
- Add test step to GitHub Actions PR workflow
- Update .gitignore for coverage and vitest cache directories
@nitishagar
Copy link
Author

@adamshiervani @ym Can you help me with a review here? I'll love your folks thought here to have a good testing setup.

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.

1 participant