local-ai-stack icon indicating copy to clipboard operation
local-ai-stack 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.37% ( 53/58 )
Branches   : 86.95% ( 20/23 )
Functions  : 85.71% ( 18/21 )
Lines      : 91.22% ( 52/57 )

Coverage metrics generated by Jest, an open-source JavaScript testing framework.
Test files and commits
  • test: add config
  • test: add src/util.test.ts
  • test: add src/app/api/qa-pinecone/route.test.ts
  • test: add src/app/api/qa-pg-vector/route.test.ts
  • test: add src/scripts/indexBlogLocal.test.mjs
  • test: add src/scripts/indexBlogPGVector.test.mjs
  • test: add src/components/TextToImgModal.test.tsx
  • test: add src/app/sign-up/[[...sign-up]]/page.test.tsx
  • test: add src/app/page.test.tsx
  • test: add src/app/layout.test.tsx
  • test: add src/app/sign-in/[[...sign-in]]/page.test.tsx
  • test: add src/components/Examples.test.tsx
  • test: add src/components/InputCard.test.tsx
  • test: add src/components/ChatComponent.test.tsx
  • test: add src/components/Navbar.test.tsx
  • test: add src/scripts/indexBlogLocal.test.mjs
  • test: add src/scripts/indexBlogs.test.mjs
  • test: add src/scripts/indexBlogPGVector.test.mjs
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 run 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 21 '26 03:05 ToTheos-Dev