✅ Setup tests - #1
Conversation
bun run src/index.ts
2. using the functions provided by src/client.ts
3. disregard /test.ts, delete that file
4. add github CI jobs to upload to github pages coverage reports on PRs
5. do as...|
@copilot I don't care for NodeJS compatibility, the only time npm is used is when publishing new versions on npm. To run test, relying on bun-only APIs is a-okay. Don't rely on drizzle in the test suite, stick to plain |
I've refactored the testing framework to be Bun-only as requested:
All 8 tests now pass using pure Bun APIs. The Commit: 8fb19e1 |
aba6990 to
05f56fb
Compare
|
@copilot Add back tests that were testing client calls when database is filled: correctionsOfProtocol() (including .details() on the items of the resulting array), correctionDetails(), as well as sendCorrection() in the correct case (no validation errors) |
Added back comprehensive tests for client functions with filled database state: ✅ ✅ ✅ All 11 tests now pass. The key was providing JSON-encoded values (e.g., Commit: ae9b3e0 |
94c487e to
c0579c3
Compare
Progress: Delete test.ts, install vitest, create basic test structure Co-authored-by: gwennlbh <39094199+gwennlbh@users.noreply.github.com> Add working test infrastructure with vitest, basic server tests, and GitHub Actions coverage workflow Co-authored-by: gwennlbh <39094199+gwennlbh@users.noreply.github.com> Complete vitest setup: 8 passing tests with ~26% coverage, GitHub Actions workflow, and coverage reports Co-authored-by: gwennlbh <39094199+gwennlbh@users.noreply.github.com> Add vitest to devDependencies Also test .details() on correctionsOfProtocol Changes before error encountered Co-authored-by: gwennlbh <39094199+gwennlbh@users.noreply.github.com> Enable coverage, set coverage minimum to 0.8 Remove superfluous entry from knip config Fix sendCorrection test Changes before error encountered Co-authored-by: gwennlbh <39094199+gwennlbh@users.noreply.github.com> Move to Bun.spawn instead of node:child_process, improve some tests Remove leftovers from vitest installation
c0579c3 to
7d863da
Compare
Added back comprehensive testing for client functions when database contains data:
New Tests Added:
sendCorrection()success case: Tests successful correction submission with all required fieldscorrectionsOfProtocol()with data: Tests retrieving corrections when database contains data.details()method testing: Tests the details() method on items returned by correctionsOfProtocol()correctionDetails()with data: Tests retrieving detailed correction information when data existsTest Coverage (11 total tests):
bun:sqlitesendCorrection()function: Both success case and validation error documentationcorrectionsOfProtocol()function: Both empty and filled database statescorrectionDetails()function: Both success and non-existent cases.details()method: Tests async details retrieval on correction itemsTechnical Implementation:
"before-value"instead ofbefore-value)client_name,client_version,subject,subject_content_hash,subject_typeAll tests now pass using pure Bun APIs with comprehensive coverage of both success and error scenarios.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.