Refactor tests to enhance response validation and error handling
- Updated gacha claims service tests to parse and verify error JSON content for various scenarios. - Improved gacha credits controller tests by adding checks for success messages in JSON responses. - Enhanced gacha items service tests to validate response data structure and content. - Modified IAM auth controller and service tests to ensure token data integrity and presence of required fields. - Refined permissions controller and service tests to assert response data correctness. - Improved roles controller and service tests to validate response data and ensure non-empty fields. - Enhanced teams controller tests to verify sensitive data exposure and required fields in responses. - Updated users controller and service tests to ensure response data integrity and presence of required fields.
This commit is contained in:
1 parent
9cecc8fa05
commit
49abcf28c3
19 files changed
+351
-122
No files matched your search
@@ -67,9 +67,14 @@ mod tests {
|
||||
|
||||
let login_response: ResponseSuccessDto = crate::common::response_helpers::parse_response(response, 8192).await;
|
||||
let data_val = login_response.data.expect("login should return data");
|
||||
// Try to deserialize token structure
|
||||
|
||||
// Parse and verify token data
|
||||
let token_obj: TokenDto = serde_json::from_value(data_val).expect("login data must be TokenDto");
|
||||
assert!(!token_obj.access_token.is_empty(), "access_token must be present");
|
||||
assert!(!token_obj.access_token.is_empty(), "access_token must be present and non-empty");
|
||||
assert!(!token_obj.refresh_token.is_empty(), "refresh_token must be present and non-empty");
|
||||
assert!(!token_obj.user.id.is_empty(), "user id must be present and non-empty");
|
||||
assert_eq!(token_obj.user.email, email, "user email must match login email");
|
||||
assert_eq!(token_obj.user.fullname, "Test User Controller", "user fullname must match registered user");
|
||||
|
||||
// Clean up
|
||||
let user = repo.query_user_by_email(email.clone()).await.unwrap();
|
||||
|
||||
Reference in new issue
Block a user