Skip to content

Commit fab6a39

Browse files
committed
test(sqlx): strengthen GROUP BY assertion with specific count
Replace weak assertion (> 0) with specific assertion (== 3) based on fixture data. The encrypted_json fixture creates exactly 3 distinct encrypted records, so GROUP BY should return exactly 3 groups. This makes the test more rigorous and will catch regressions if grouping behavior changes. Addresses FINAL_CODE_REVIEW.md recommendation #3 (P3).
1 parent a085f81 commit fab6a39

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/sqlx/tests/aggregate_tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ async fn min_aggregate_on_encrypted_column(pool: PgPool) -> Result<()> {
5252
async fn group_by_with_encrypted_column(pool: PgPool) -> Result<()> {
5353
// Test: GROUP BY works with encrypted data
5454
// Original SQL lines 47-50 in src/encrypted/aggregates_test.sql
55+
// Fixture creates 3 distinct encrypted records, each unique
5556

5657
let group_count: i64 = sqlx::query_scalar(
5758
"SELECT COUNT(*) FROM (
@@ -61,7 +62,10 @@ async fn group_by_with_encrypted_column(pool: PgPool) -> Result<()> {
6162
.fetch_one(&pool)
6263
.await?;
6364

64-
assert!(group_count > 0, "GROUP BY should return groups");
65+
assert_eq!(
66+
group_count, 3,
67+
"GROUP BY should return 3 groups (one per distinct encrypted value in fixture)"
68+
);
6569

6670
Ok(())
6771
}

0 commit comments

Comments
 (0)