add test for get_user_profile

This commit is contained in:
kozabrada123 2024-08-18 14:50:13 +02:00
parent ade43f2a97
commit 2f2407467e
1 changed files with 23 additions and 0 deletions

View File

@ -3,6 +3,12 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use chorus::types::{PublicUser, Snowflake, User};
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::*;
#[cfg(target_arch = "wasm32")]
wasm_bindgen_test_configure!(run_in_browser);
mod common;
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), test)]
@ -20,3 +26,20 @@ fn to_public_user() {
let from_user = user.into_public_user();
assert_eq!(public_user, from_user);
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn test_get_user_profile() {
let mut bundle = common::setup().await;
let user_id = bundle.user.object.read().unwrap().id;
let user_profile = bundle
.user
.get_user_profile(user_id, chorus::types::GetUserProfileSchema::default())
.await;
assert!(user_profile.is_ok());
common::teardown(bundle).await;
}