Skip to content

chore: add test infrastructure and initial test suite#91

Open
dtoxvanilla1991 wants to merge 2 commits into
mainfrom
chore/add-test-infrastructure
Open

chore: add test infrastructure and initial test suite#91
dtoxvanilla1991 wants to merge 2 commits into
mainfrom
chore/add-test-infrastructure

Conversation

@dtoxvanilla1991

@dtoxvanilla1991 dtoxvanilla1991 commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Ports the test additions from community PR #57 (by @p-stam001) onto current main, adapted for the current stack.

What's added

  • vitest.config.ts - explicit vitest configuration with node environment, v8 coverage (text/json/html reporters), include/exclude patterns scoped to lib/, and @ alias pointing to /lib
  • lib/constants.test.ts - 3 tests for DEFAULT_TOKEN_SCOPES
  • lib/types.test.ts - 15 tests covering all exported types: LoginSuccessResponse, LoginFailureResponse, LoginResponse, LogoutRequest, LogoutResult, PermissionAccess, Permissions, and UserProfile (including a test for the optional-fields case)

What was changed vs. PR #57

  • No new dependencies - vitest and @vitest/coverage-v8 are already on main at ^4.0.0
  • Dropped jsdom devDep - the environment is node, so jsdom is not needed
  • Removed globals: true - test files use explicit import { describe, it, expect } from 'vitest' imports, consistent with the existing codebase style
  • Removed @vitejs/plugin-react from vitest config - not needed for node-env tests (it's already in vite.config.ts for the build)
  • Added a second UserProfile test asserting that only id is required (exercising the optional fields added in chore: upgrade TypeScript to v6 with migration fixes #90)

Test results

 ✓ lib/types.test.ts (12 tests)
 ✓ lib/constants.test.ts (3 tests)

 Test Files  2 passed (2)
      Tests  15 passed (15)
   Duration  129ms

Closes #57

@dtoxvanilla1991 dtoxvanilla1991 requested a review from a team as a code owner April 17, 2026 23:44
@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@dtoxvanilla1991 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 3 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 48 minutes and 3 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 121b31de-8661-48e5-87fa-31e3bbbf1c07

📥 Commits

Reviewing files that changed from the base of the PR and between d24fdf8 and 5840e44.

📒 Files selected for processing (3)
  • lib/constants.test.ts
  • lib/types.test.ts
  • vitest.config.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-test-infrastructure

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dtoxvanilla1991 dtoxvanilla1991 self-assigned this Apr 17, 2026
Koosha-Owji
Koosha-Owji previously approved these changes Apr 20, 2026
@Koosha-Owji

Copy link
Copy Markdown
Contributor

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Apr 20, 2026

Copy link
Copy Markdown
✅ Actions performed

Reviews resumed.

@Koosha-Owji Koosha-Owji dismissed their stale review April 20, 2026 07:37

approved by mistake

Comment thread lib/types.test.ts Outdated
Port of community PR #57 by @p-stam001 (adapted for current main).

- Add vitest.config.ts with node environment, v8 coverage, include/exclude
  patterns, and @ alias
- Add lib/constants.test.ts: 3 tests for DEFAULT_TOKEN_SCOPES
- Add lib/types.test.ts: 15 tests covering all exported types including
  a second UserProfile test that exercises the optional fields
- No new dependencies needed (vitest/coverage-v8 already on main)
- Drops jsdom devDep from original PR (not needed with node environment)
- Drops globals: true and react() plugin (unnecessary for node env)
All UserProfile fields are required in types.ts; the test asserting
only 'id' is required was incorrect. Addresses review feedback from
Koosha-Owji on PR #91.
@dtoxvanilla1991 dtoxvanilla1991 force-pushed the chore/add-test-infrastructure branch from 17494bb to 5840e44 Compare April 25, 2026 21:49
@dtoxvanilla1991

Copy link
Copy Markdown
Contributor Author

@Koosha-Owji please re-review. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants