Skip to content

Add unit and integration tests for components and update build config (Step 4)#151

Open
milindmore22 wants to merge 12 commits into
migrate/scaffoldfrom
tests/backfill-jest
Open

Add unit and integration tests for components and update build config (Step 4)#151
milindmore22 wants to merge 12 commits into
migrate/scaffoldfrom
tests/backfill-jest

Conversation

@milindmore22

@milindmore22 milindmore22 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What

This PR adds comprehensive unit tests for several core JavaScript React components (OnboardingScreen, SettingsPage, GitHubRepoToken, and PluginCard) and updates the Codecov configuration to exclude specific frontend files from coverage reporting.

Why

These changes are necessary to improve the overall test coverage, reliability, and stability of the frontend components. Additionally, updating the .codecov.yml configuration ensures that our coverage metrics are accurate by removing files that do not require testing (such as icons) from the coverage calculations.

Related Issue(s):

Covers Step 4 : https://github.com/rtCamp/OnePress/issues/78
Step 1 : #149

How

The improvements were implemented through the following updates:

  • OnboardingScreen: Added unit tests covering site type loading, error handling, saving, and redirection logic.
  • SettingsPage: Added unit tests covering site management, error notices, and conditional rendering for different site types (child components were mocked for test isolation).
  • GitHubRepoToken: Added unit tests to verify token fetching, input changes, API interactions, and error handling.
  • PluginCard: Added unit tests for rendering, selection, version changes, and callback invocations.
  • Codecov: Updated .github/.codecov.yml to ignore all files in assets/src/components/icons/ and JavaScript files in assets/src/js/.

Testing Instructions

  1. Pull down this branch locally.
  2. Run the frontend unit test suite (e.g., using npm run test:js or npm run test:js:coverage).
  3. Verify that all test suites for OnboardingScreen, SettingsPage, GitHubRepoToken, and PluginCard pass successfully.
  4. Verify that the CI/CD pipeline passes and that the generated Codecov report excludes the assets/src/components/icons/ and assets/src/js/ directories.

Screenshots

N/A - This PR focuses on unit tests and configuration files.

Additional Info

N/A

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • My code is tested to the best of my abilities.
  • My code passes all lints (ESLint etc.).
  • My code has detailed inline documentation.
  • I have updated the project documentation as needed.
Open WordPress Playground Preview

@milindmore22 milindmore22 changed the title Add unit and integration tests for components and update build config Add unit and integration tests for components and update build config (step 4.1) Jul 6, 2026
@milindmore22
milindmore22 marked this pull request as ready for review July 6, 2026 12:00
@milindmore22 milindmore22 changed the title Add unit and integration tests for components and update build config (step 4.1) Add unit and integration tests for components and update build config (step 4) Jul 7, 2026
@milindmore22 milindmore22 changed the title Add unit and integration tests for components and update build config (step 4) Add unit and integration tests for components and update build config (Step 4) Jul 7, 2026
@milindmore22
milindmore22 requested a review from justlevine July 7, 2026 10:17
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