codecov-browser-extension icon indicating copy to clipboard operation
codecov-browser-extension copied to clipboard

test: add unit tests generated by ToTheos

Open ToTheos-Dev opened this issue 6 months ago • 0 comments

AI-Generated Unit Tests

This PR adds AI-generated unit tests to improve coverage and ensure key functionality is tested.

Test coverage summary
Statements : 91.36% ( 307/336 )
Branches   : 79.5% ( 97/122 )
Functions  : 88.46% ( 46/52 )
Lines      : 91.31% ( 305/334 )

Coverage metrics generated by Jest, an open-source JavaScript testing framework.
Test files and commits
  • test: add config
  • test: add src/types.test.ts
  • test: add src/background/main.test.ts
  • test: add src/background/dynamic_content_scripts.test.ts
  • test: add src/utils.test.ts
  • test: add src/options/main.test.tsx
  • test: add src/constants.test.ts
  • test: add src/popup/main.test.tsx
  • test: add src/content/github/file/utils/dropdown.test.tsx
  • test: add src/content/github/file/utils/constants.test.ts
  • test: add src/content/github/file/main.test.tsx
  • test: add src/content/github/pr/constants.test.ts
  • test: add src/content/github/pr/main.test.tsx
  • test: add src/content/github/common/animation.test.ts
  • test: add src/content/github/common/utils.test.ts
  • test: add src/content/github/common/fetchers.test.ts
  • test: add src/content/github/common/constants.test.ts
  • test: add src/content/common/sentry.test.ts
  • test: add src/service.test.ts
How to run tests

Jest is included as a dev dependency.

Run tests directly

./node_modules/.bin/jest

Optional: add npm scripts

You can add convenient scripts to package.json:

{
  "scripts": {
    "test": "jest",
    "test:watch": "jest --watch",
    "test:coverage": "jest --coverage --coverageReporters=text-summary"
  }
}

Usage examples

Run tests once:

npm test

Run tests in watch mode during development:

npm run test:watch

Run tests with coverage summary:

npm run test:coverage

This contribution was created with assistance from ToTheos (https://totheos.com) to support test generation, code refactoring, and pull request preparation for an open-source codebases.

The tool was used to automate routine software development tasks.

ToTheos-Dev avatar May 18 '26 04:05 ToTheos-Dev