Repository navigation
test: add Vitest unit tests and CI - #3
Merged
Merged
Conversation
- Client tests: headers, error messages, schema-mismatch errors, debug logging - Endpoint tests: every method builds the right URL and query string - Schema tests: sample responses parse, bad data fails, undocumented attachment kinds stay accepted - typecheck script covering src and test - GitHub Actions workflow: typecheck, test and build on Node 22 and 24 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ellf
force-pushed
the
test/vitest-unit-tests
branch
from
November 4, 2026 10:41
abeacb2 to
cd86b25
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The repo had no automated tests or CI. This adds both.
Tests (76, all passing)
test/client.test.ts: API key check, theapiKeyandAcceptheaders, error messages for failed requests, the per-field message when a response doesn't match its schema, unknown-field handling (the looseCourseSchemakeeps extra fields, the others drop them), andgetRawdebug logging.test/endpoints.test.ts: one row per SDK method, checking the exact URL and query string, including filters,falsebooleans and the optionaluser_idongetVideo.test/schemas.test.ts: every response schema accepts a realistic sample, bad data is rejected, and undocumented lecture attachment kinds stay accepted (the 1.0.2 and 1.1.0 fixes).fetchis faked, so tests need no API key and never call Teachable. All sample data intest/fixtures.tsis made up.To check the tests catch problems, I broke the source on purpose in three ways (renamed the
is_publishedquery param, removedpdf_embedfrom the known kinds, changed theapiKeyheader). Four tests failed, as they should.Tooling
npm test,npm run test:watch,npm run typecheck(checkssrcandtest).github/workflows/ci.yml: typecheck, test and build on Node 22 and 24, for PRs and pushes to mainNotes
npm audit: 0 vulnerabilities.🤖 Generated with Claude Code