improvements and fixing of the tests
This commit is contained in:
@@ -173,26 +173,24 @@ async fn test_fail_on_true_self_referential_link(#[future] pool: PgPool) {
|
||||
#[tokio::test]
|
||||
async fn test_behavior_on_empty_profile_name(#[future] pool: PgPool) {
|
||||
// Scenario: Attempt to create a table with an empty profile name.
|
||||
// Expected: This should violate the database's NOT NULL constraint on profiles.name.
|
||||
// Expected: This should be rejected by input validation.
|
||||
let pool = pool.await;
|
||||
let request = PostTableDefinitionRequest {
|
||||
profile_name: "".into(),
|
||||
table_name: "table_in_empty_profile".into(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Act
|
||||
let result = post_table_definition(&pool, request).await;
|
||||
|
||||
// Assert
|
||||
let err = result.unwrap_err();
|
||||
assert_eq!(
|
||||
err.code(),
|
||||
Code::Internal,
|
||||
"Expected Internal error from DB constraint violation"
|
||||
Code::InvalidArgument, // Changed from Internal
|
||||
"Expected InvalidArgument error from input validation"
|
||||
);
|
||||
assert!(
|
||||
err.message().to_lowercase().contains("profile error"),
|
||||
err.message().contains("Profile name cannot be empty"), // Updated message
|
||||
"Unexpected error message: {}",
|
||||
err.message()
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user