Skip to content

Test: Improve UI test coverage and fix Jest setup#358

Open
japinderofficial-hub wants to merge 1 commit into
fossology:mainfrom
japinderofficial-hub:improve-test-coverage-159
Open

Test: Improve UI test coverage and fix Jest setup#358
japinderofficial-hub wants to merge 1 commit into
fossology:mainfrom
japinderofficial-hub:improve-test-coverage-159

Conversation

@japinderofficial-hub

Copy link
Copy Markdown

Description

Add Jest configuration, Babel preset, and test-only mocks/shims so frontend UI tests run reliably in this repo.
Add beginner-friendly component tests and convert several fragile tests to React Testing Library where practical.
Keep production code unchanged; all edits are test-only (configs, mocks, and tests).

Changes

• Added and updated test configuration:

  • .babelrc with preset-react (runtime: automatic)
  • Jest config and setup (jest.config.cjs, jest/setupTests.js)
  • Jest mocks/shims for react-dom, queryString, and file/style imports
  • UI stabilization via styledComponentsMock.js and jest/ui-mocks/*

• Added test coverage for:

  • index, footer, tree
  • Widget components (Alert, Button, Input, TextIcon)
  • UI inputs (input, textarea)

• Migrated index.test.jsx to React Testing Library (RTL)

How to test

Install dependencies:
yarn install

Run the test suite:
yarn test --runInBand

Expected result:
All frontend tests execute; on my run the suite passed (12 suites, 18 tests).

Quick checks:
Confirm no production files were modified (only test/config files and new tests).
Run single suites while iterating, for example:
yarn test button.test.jsx

close #159

Copilot AI review requested due to automatic review settings January 24, 2026 15:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@japinderofficial-hub

Copy link
Copy Markdown
Author
Screenshot 2026-01-24 at 11 03 47 PM

All the tests passed successfully

@github-actions github-actions Bot added the has merge conflicts PR has merge conflicts, require rebase label Jun 18, 2026
@github-actions

Copy link
Copy Markdown

This pull request has conflicts, please rebase to resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has merge conflicts PR has merge conflicts, require rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Testing: Improve test coverage

2 participants