local-ai-stack
local-ai-stack copied to clipboard
test: add unit tests generated by ToTheos
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 configtest: add src/util.test.tstest: add src/app/api/qa-pinecone/route.test.tstest: add src/app/api/qa-pg-vector/route.test.tstest: add src/scripts/indexBlogLocal.test.mjstest: add src/scripts/indexBlogPGVector.test.mjstest: add src/components/TextToImgModal.test.tsxtest: add src/app/sign-up/[[...sign-up]]/page.test.tsxtest: add src/app/page.test.tsxtest: add src/app/layout.test.tsxtest: add src/app/sign-in/[[...sign-in]]/page.test.tsxtest: add src/components/Examples.test.tsxtest: add src/components/InputCard.test.tsxtest: add src/components/ChatComponent.test.tsxtest: add src/components/Navbar.test.tsxtest: add src/scripts/indexBlogLocal.test.mjstest: add src/scripts/indexBlogs.test.mjstest: add src/scripts/indexBlogPGVector.test.mjs
How to run tests
Jestis included as a dev dependency.Run tests directly
./node_modules/.bin/jestOptional: 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 testRun tests in watch mode during development:
npm run test:watchRun 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.