not working, needs fixes

This commit is contained in:
filipriec
2025-02-24 21:44:41 +01:00
parent c612409808
commit 160a5e488c
2 changed files with 6 additions and 20 deletions

View File

@@ -1,4 +1,5 @@
// tests/adresar/get_adresar_count_test.rs
use rstest::{fixture, rstest};
use server::adresar::handlers::get_adresar_count;
use common::proto::multieko2::common::{CountResponse, Empty};
@@ -57,7 +58,7 @@ async fn test_count_empty_database(#[future] pool: PgPool) {
async fn test_count_mixed_records(#[future] mixed_records: PgPool) {
let pool = mixed_records.await;
let response = get_adresar_count(&pool, Empty {}).await.unwrap();
assert_eq!(response.count, 3);
assert_eq!(response.count, 3); // Only non-deleted records are counted
}
#[rstest]
@@ -74,7 +75,7 @@ async fn test_count_after_deletion(#[future] mixed_records: PgPool) {
.unwrap();
let response = get_adresar_count(&pool, Empty {}).await.unwrap();
assert_eq!(response.count, 2);
assert_eq!(response.count, 2); // One fewer non-deleted record
}
#[rstest]
@@ -97,7 +98,7 @@ async fn test_count_all_deleted(#[future] pool: PgPool) {
.unwrap();
let response = get_adresar_count(&pool, Empty {}).await.unwrap();
assert_eq!(response.count, 0);
assert_eq!(response.count, 0); // No non-deleted records
}
#[rstest]
@@ -105,7 +106,6 @@ async fn test_count_all_deleted(#[future] pool: PgPool) {
async fn test_database_error(#[future] closed_pool: PgPool) {
let closed_pool = closed_pool.await;
let result = get_adresar_count(&closed_pool, Empty {}).await;
assert!(result.is_err());
assert_eq!(result.unwrap_err().code(), tonic::Code::Internal);
}
@@ -130,5 +130,5 @@ async fn test_count_after_insert(#[future] pool: PgPool) {
// Verify updated count
let response = get_adresar_count(&pool, Empty {}).await.unwrap();
assert_eq!(response.count, 1);
assert_eq!(response.count, 1); // One new non-deleted record
}