π§ͺ [testing improvement] Add test coverage for auth providers configuration
π― What: The testing gap addressed
The getEnabledSocialProvidersConfig function in lib/auth-providers.ts was untested because it depended on a statically initialized providerEnv object that read process.env at module load time. This made manipulating environment variables in standard Node.js tests difficult.
By refactoring providerEnv into a lazily evaluated getProviderEnv(provider) function, the module becomes entirely testable using native Node testing hooks (process.env reassignment).
π Coverage: What scenarios are now tested
- Empty configuration when no provider secrets are present.
- Single provider (GitHub) returning correct configuration.
- Empty strings correctly evaluated as missing secrets.
- Multiple configurations returned when multiple providers (GitHub, Discord) are enabled.
β¨ Result: The improvement in test coverage
lib/auth-providers.ts is now covered by standard node:test tests. Also added a npm run test script to package.json that reliably executes these TypeScript tests with --conditions=react-server and tsx integration to gracefully bypass Next.js specific alias issues.
PR created automatically by Jules for task 12198110488065936914 started by @AdityaKodez
Summary by CodeRabbit
-
Tests
- Added comprehensive test suite for authentication provider configuration validation, covering scenarios with no providers, single providers, and multiple providers enabled.
-
Chores
- Added test runner infrastructure and refactored authentication provider configuration logic for improved maintainability.
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Actions | Updated (UTC) |
|---|---|---|---|
| gridly | Preview, Comment | Mar 8, 2026 2:20pm |
[!IMPORTANT] Review skipped
Bot user detected.
To trigger a single review, invoke the
@beetlecommand.
βοΈ Settings
Severity Threshold: Medium β Balanced feedback β medium and high severity issues only. β Change in Settings
Custom Rules: Define your own review rules β Set Custom Rules
PR Summary: Configure PR summary β Change in Settings
π User Guide
- Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
- Comment
@beetleon any PR to start analysis manually - Comment
@beetle stopto stop any ongoing analysis
Adds a comprehensive test suite for authentication provider configuration helpers and refactors the provider environment variable lookup from a static mapping to a dynamic function. The package.json is updated with TypeScript test support via tsx. π― 3 (Moderate) | β±οΈ ~25 minutes π° We've hopped through the code with tests held high, βοΈ Tip: You can configure your own custom pre-merge checks in the settings.π Walkthrough
Walkthrough
Changes
Cohort / File(s)
Summary
Test Infrastructure
package.jsonAdded
test script leveraging tsx for TypeScript support and added tsx as a devDependency (^4.21.0).
Auth Provider Tests
lib/auth-providers.test.tsNew comprehensive test suite validating behavior when no providers, single providers (GitHub), or multiple providers (GitHub and Discord) are configured. Tests verify configuration object structure and provider array ordering.
Auth Provider Refactoring
lib/auth-providers.tsReplaced static
providerEnv object with a getProviderEnv(provider) function that returns provider-specific environment variables via switch statement. Updated parseProviderSecrets to use the new function; no public API changes.Estimated code review effort
Poem
Provider configs now dance and comply,
TypeScript flows with tsx in hand,
A refactored realm, neat and grand! β¨π₯ Pre-merge checks | β
2 | β 1
β Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
β οΈ Warning
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
β
Passed checks (2 passed)
Check name
Status
Explanation
Description Check
β
Passed
Check skipped - CodeRabbitβs high-level summary is enabled.
Title check
β
Passed
The title accurately describes the main change: adding test coverage for auth providers configuration. However, it includes an emoji (π§ͺ) and a bracketed tag ([testing improvement]) that could be considered noise, though the core message is clear and directly related to the changeset.
β¨ Finishing Touches
π§ͺ Generate unit tests (beta)
testing-improvement-auth-providers-12198110488065936914
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.
Comment @coderabbitai help to get the list of available commands and usage tips.