test(cli): add vitest infrastructure and tests for auth functionality#24
Draft
romitg2 wants to merge 4 commits intocalcom:mainfrom
Draft
test(cli): add vitest infrastructure and tests for auth functionality#24romitg2 wants to merge 4 commits intocalcom:mainfrom
romitg2 wants to merge 4 commits intocalcom:mainfrom
Conversation
…ality - Add vitest dependency and test scripts to @calcom/cli - Create test setup file with mock resets - Create test helpers for fs mocking, process.exit handling, and fixtures - Add comprehensive tests for config.ts (18 tests) - Add comprehensive tests for errors.ts (16 tests) - Add comprehensive tests for auth.ts (6 tests) - Add test job to CI workflow - Add root-level test script to run CLI tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename test job to "Test CLI" for clarity - Remove unused consoleLogSpy and consoleErrorSpy variables Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1542e1d to
bba08d9
Compare
- Test 60-second buffer pre-expiry refresh - Test config persistence after token refresh - Test invalid expiry date handling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
@calcom/clipackageChanges
Test Infrastructure
vitestas dev dependencysrc/__tests__/setup.ts) with automatic mock resetsmockFs.ts- File system mocking utilitiesmockProcess.ts-process.exitand console mockingfixtures.ts- Test data (configs, tokens, error bodies)Test Coverage
config.test.ts(21 tests)readConfigreadConfigreadConfigreadConfigwriteConfigwriteConfiggetApiUrlgetApiUrlgetApiUrlgetAppUrlgetAppUrlgetAppUrlgetAuthTokengetAuthTokengetAuthTokengetAuthTokengetAuthTokengetAuthTokengetAuthTokengetAuthTokengetAuthTokenerrors.test.ts(16 tests)handleSdkErrorhandleSdkErrorhandleSdkErrorhandleSdkErrorhandleSdkErrorhandleSdkErrorhandleSdkErrorhandleSdkErrorhandleSdkErrorhandleSdkErrorhandleSdkErrorhandleSdkErrorwithErrorHandlingwithErrorHandlingwithErrorHandlingwithErrorHandlingauth.test.ts(6 tests)ApiKeyAuth.loginApiKeyAuth.loginApiKeyAuth.loginOAuthAuth.refreshTokenOAuthAuth.refreshTokenOAuthAuth.refreshTokenCI Integration
CLI - Unit Testsjob to.github/workflows/ci.ymltestscript topackage.jsonTest plan
bun run testlocally - all 43 tests pass🤖 Generated with Claude Code