Skip to content

Commit

Permalink
Added test for anonymous sign in
Browse files Browse the repository at this point in the history
  • Loading branch information
Proziam committed Oct 27, 2024
1 parent c3a1b21 commit a276c5b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "supabase-auth"
authors = ["Eric Biggs"]
description = "Supabase Auth implementation following the official client libraries."
readme = "README.md"
version = "0.10.1"
version = "0.10.2"
edition = "2021"
license = "MIT OR Apache-2.0"
keywords = ["supabase", "supabase-auth", "authentication", "auth"]
Expand Down
2 changes: 2 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ impl AuthClient {
/// named like this here. You can also pass in the same signup options
/// that work for the other `sign_up_*` methods, but that's not required.
///
/// This method requires anonymous sign in to be enabled in your dashboard.
///
/// # Example
/// ```
/// let session = auth_client
Expand Down
6 changes: 4 additions & 2 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ pub struct User {

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Default)]
pub struct AppMetadata {
pub provider: String,
pub providers: Vec<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub provider: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub providers: Option<Vec<String>>,
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Default)]
Expand Down
11 changes: 11 additions & 0 deletions tests/client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,17 @@ async fn invite_by_email_test() {
assert!(user.email == demo_email)
}

#[tokio::test]
async fn sign_in_anonymously_test() {
let auth_client = create_test_client();

let session = auth_client.sign_in_anonymously(None).await.unwrap();

println!("{}", session.user.created_at);

assert!(!session.access_token.is_empty() && session.user.role == "authenticated")
}

#[tokio::test]
async fn get_settings_test() {
let auth_client = create_test_client();
Expand Down

0 comments on commit a276c5b

Please sign in to comment.