-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add unit test for src/services/_auth.ts #5754
base: testgru-src-store-user-slices-modelList-selectors-keyVaults.ts-1738674536186
Are you sure you want to change the base?
test: add unit test for src/services/_auth.ts #5754
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
👍 @gru-agent[bot] Thank you for raising your pull request and contributing to our Community |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## testgru-src-store-user-slices-modelList-selectors-keyVaults.ts-1738674536186 #5754 +/- ##
==============================================================================================================
Coverage 92.28% 92.28%
==============================================================================================================
Files 646 646
Lines 58020 58023 +3
Branches 2713 2915 +202
==============================================================================================================
+ Hits 53541 53546 +5
+ Misses 4479 4477 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Trigger Info
Summary
This PR introduces unit tests for the
_auth
module, ensuring the correctness of its core functionalities. The following key areas are covered:getProviderAuthPayload
Tests:Validates the payload generation for various providers (
Bedrock
,Azure
,Ollama
,Cloudflare
).Ensures fallback behavior for unknown providers.
Tests specific cases like using
endpoint
asbaseURL
for Azure whenbaseURL
is not provided.createAuthTokenWithPayload
Tests:Verifies JWT token creation with both custom and empty payloads.
Mocks dependencies like
keyVaultsConfigSelectors
anduserProfileSelectors
.createHeaderWithAuth
Tests:Confirms headers are correctly generated with the auth token.
Tests behavior for deprecated and non-deprecated editions, including provider-specific payload inclusion.
Refactor and Export:
createAuthTokenWithPayload
for external usage.These tests ensure robust validation of authentication-related logic and improve maintainability by mocking external dependencies.
Tip
You can
@gru-agent
and leave your feedback. TestGru will make adjustments based on your inputTip
You can
@gru-agent rebase
to rebase the PR.Tip
You can
@gru-agent redo
to reset or rebase before redoing the PR.Tip
To modify the test code yourself, click here Edit Test Code