Add comprehensive tests for mentor repository and authentication
- Implemented tests for creating, retrieving, updating, and deleting mentors in `mentor_repository_test.rs`. - Added tests for user authentication, including successful login, invalid email formats, and inactive users in `auth_login_tests.rs`. - Created a mock test environment setup in `mock_test.rs` to facilitate database operations during tests. - Updated module structure to include new test files for mentors and authentication. - Ensured cleanup of the database after tests to maintain isolation and prevent side effects.
This commit is contained in:
@@ -45,7 +45,12 @@ impl GachaItemService {
|
||||
return common_response(status, &message);
|
||||
}
|
||||
let repo = GachaItemRepository::new(state);
|
||||
let schema = GachaItemSchema::from(payload);
|
||||
let schema = GachaItemSchema {
|
||||
id: make_thing(&ResourceEnum::GachaItems.to_string(), &payload.name), // Fixed: Use payload.name or some other identifier
|
||||
name: payload.name,
|
||||
image_url: payload.image_url,
|
||||
..Default::default()
|
||||
};
|
||||
match repo.query_create_gacha_item(schema).await {
|
||||
Ok(msg) => common_response(StatusCode::CREATED, &msg),
|
||||
Err(e) => common_response(StatusCode::INTERNAL_SERVER_ERROR, &e.to_string()),
|
||||
|
||||
Reference in New Issue
Block a user