Skip to content
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 tests for authentication tokens and SSO #9937

Merged
merged 4 commits into from
Feb 11, 2025
Merged

Conversation

anthonyshew
Copy link
Contributor

@anthonyshew anthonyshew commented Feb 10, 2025

Description

Adding some tests before I do some bug hunting/fixing.

Testing Instructions

CI

@anthonyshew anthonyshew requested a review from a team as a code owner February 10, 2025 22:31
Copy link

vercel bot commented Feb 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 8:44pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 8:44pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 8:44pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 8:44pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 8:44pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 8:44pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 8:44pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 8:44pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 8:44pm

Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also remove the HTTP server from test_sso_login without impacting the test.

) -> turborepo_api_client::Result<turborepo_vercel_api::token::ResponseTokenMetadata>
{
if token.is_empty() {
return Err(MockApiError::EmptyToken.into());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there really not a test that asserted this mocked out error? :lolsob:

#[tokio::test]
async fn test_sso_login_force_new_token() {
let port = port_scanner::request_open_port().unwrap();
let api_server = tokio::spawn(start_test_server(port));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to start an HTTP server since we're mocking out the HTTP requests via the MockApiClient

Suggested change
let api_server = tokio::spawn(start_test_server(port));

crates/turborepo-auth/src/lib.rs Show resolved Hide resolved
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