Testing and Quality
Tooling
- TypeScript (
strictmode) - Vitest
- Prettier
Scripts
From package.json:
npm run build-> compile TypeScript todistnpm run typecheck-> strict TS no-emit checknpm run test-> execute unit tests with Vitestnpm run lint-> Prettier check passnpm run format-> Prettier write passnpm run prepublishOnly-> build + typecheck + lint
Current Test Suite
tests/oauth.test.ts
Covers OAuth manager basics:
- authorization URL assembly
- required query parameter behavior
- PKCE verifier/challenge generation shape and length
tests/client.test.ts
Covers client core behavior:
- request envelope unwrapping (
{ data: ... }) - bearer header injection with access token
- automatic 401 refresh-and-retry flow
- token update propagation (
accessToken/refreshToken) tokenRefreshevent emission
tests/managers.test.ts
Covers endpoint mapping by manager:
- Releases manager route and method mapping
- Tracks manager route and method mapping
- Preferences manager route and method mapping
- Lookup and User manager route and method mapping
- query serialization checks for selected endpoints
Quality Characteristics
- Public SDK surface is strongly typed and exported for consumer use.
- Request methods preserve endpoint-specific request and response signatures.
- Runtime errors are normalized into
TooLostAPIErrorfor non-2xx API responses. - Retry and refresh behavior is deterministic and covered at core-flow level.
Current Gaps
These are known opportunities for stronger assurance:
- no live integration tests against Toolost sandbox/real API
- no contract snapshot tests for full response object shapes
- no fuzz/property tests for query serialization edge cases
- no dedicated concurrency stress tests for
inflightRefreshbehavior - no explicit performance benchmarks
Recommended Next Tests
- Add integration tests behind environment-gated credentials.
- Add focused retry tests validating backoff timing and retry stop conditions.
- Add tests for
skipAuth, custom headers, and body serialization edge cases. - Add regression tests for alias methods to ensure parity with canonical methods.
- Add schema-level validation tests for critical manager payloads.
CI Guidance
A minimal CI quality gate should run:
npm cinpm run typechecknpm testnpm run build