chore(api): apply rustfmt across modules and tests

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Chengdong Zhang
2026-09-21 18:52:52 +08:00
co-authored by Cursor
parent 6c1357ec4d
commit a4ef6ca49e
46 changed files with 495 additions and 334 deletions
+22 -13
View File
@@ -165,7 +165,8 @@ async fn activity_requires_an_own_sku_and_two_members() {
let app = spawn_app().await;
let admin = login_admin(&app).await;
let (owner_a, _shop_a, _p, sku_a) = setup_sellable(&app, &admin, "gb-valid-a", 1000, 10).await;
let (_owner_b, _shop_b, _p2, sku_b) = setup_sellable(&app, &admin, "gb-valid-b", 1000, 10).await;
let (_owner_b, _shop_b, _p2, sku_b) =
setup_sellable(&app, &admin, "gb-valid-b", 1000, 10).await;
// Another shop's SKU is refused.
let res = create_activity_body(&app, &owner_a, &sku_b, 700, 2, 24).await;
@@ -225,7 +226,10 @@ async fn open_then_join_completes_a_group() {
.json()
.await
.unwrap();
let found = active.iter().find(|a| a["id"] == activity.as_str()).unwrap();
let found = active
.iter()
.find(|a| a["id"] == activity.as_str())
.unwrap();
assert_eq!(found["open_groups"][0]["id"], group_id.as_str());
assert_eq!(found["open_groups"][0]["paid_member_count"], 0);
@@ -317,11 +321,13 @@ async fn expired_and_cancelled_groups_are_not_joinable() {
.await
.unwrap();
assert_eq!(pay(&app, &token_a, &order_a).await, 200);
sqlx::query("UPDATE collective_groups SET expires_at = now() - interval '1 hour' WHERE id = $1")
.bind(group_id)
.execute(&app.db)
.await
.unwrap();
sqlx::query(
"UPDATE collective_groups SET expires_at = now() - interval '1 hour' WHERE id = $1",
)
.bind(group_id)
.execute(&app.db)
.await
.unwrap();
// A committed read records the expiry (a failed checkout rolls its own
// sweep back, so discovery is what persists it).
@@ -473,7 +479,8 @@ async fn activity_rejects_a_sku_with_an_overlapping_flash_sale() {
async fn cancelling_an_elapsed_empty_group_records_expired() {
let app = spawn_app().await;
let admin = login_admin(&app).await;
let (owner, _shop, _product, sku) = setup_sellable(&app, &admin, "gb-precedence", 1000, 10).await;
let (owner, _shop, _product, sku) =
setup_sellable(&app, &admin, "gb-precedence", 1000, 10).await;
let activity = create_activity(&app, &owner, &sku, 700, 3, 24).await;
let (token, _) = register_customer(&app, "gb-precedence").await;
@@ -486,11 +493,13 @@ async fn cancelling_an_elapsed_empty_group_records_expired() {
.unwrap();
// The lifetime ends before the opener cancels.
sqlx::query("UPDATE collective_groups SET expires_at = now() - interval '1 hour' WHERE id = $1")
.bind(group_id)
.execute(&app.db)
.await
.unwrap();
sqlx::query(
"UPDATE collective_groups SET expires_at = now() - interval '1 hour' WHERE id = $1",
)
.bind(group_id)
.execute(&app.db)
.await
.unwrap();
assert_eq!(cancel(&app, &token, &order).await, 200);
// Both conditions hold; an elapsed group is expired, not relabelled cancelled.