tests now working via make file
This commit is contained in:
@@ -142,6 +142,33 @@ async fn test_create_table_success(#[future] pool: PgPool) {
|
||||
.await;
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[tokio::test]
|
||||
async fn test_fail_on_invalid_decimal_format(#[future] pool: PgPool) {
|
||||
let pool = pool.await;
|
||||
let invalid_types = vec![
|
||||
"decimal(0,0)", // precision too small
|
||||
"decimal(5,10)", // scale > precision
|
||||
"decimal(10)", // missing scale
|
||||
"decimal(a,b)", // non-numeric
|
||||
];
|
||||
|
||||
for invalid_type in invalid_types {
|
||||
let request = PostTableDefinitionRequest {
|
||||
profile_name: "default".into(),
|
||||
table_name: format!("table_{}", invalid_type),
|
||||
columns: vec![ColumnDefinition {
|
||||
name: "amount".into(),
|
||||
field_type: invalid_type.into(),
|
||||
}],
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let result = post_table_definition(&pool, request).await;
|
||||
assert_eq!(result.unwrap_err().code(), Code::InvalidArgument);
|
||||
}
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[tokio::test]
|
||||
async fn test_create_table_with_link(
|
||||
|
||||
Reference in New Issue
Block a user