style(api): merge use decl; assert status + breathing room in authority test

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 22:39:36 +02:00
parent 01abd5cbbc
commit c4e0c4c834
2 changed files with 8 additions and 3 deletions
+5 -3
View File
@@ -11,9 +11,11 @@ use domain::{AuthorityKind, LocalizedLabel, NewAuthority};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use utoipa::ToSchema; use utoipa::ToSchema;
use crate::AppState; use crate::{
use crate::admin_objects::LabelView; AppState,
use crate::admin_vocab::{CreatedId, LabelInput}; admin_objects::LabelView,
admin_vocab::{CreatedId, LabelInput},
};
#[derive(Serialize, ToSchema)] #[derive(Serialize, ToSchema)]
pub(crate) struct AuthorityView { pub(crate) struct AuthorityView {
+3
View File
@@ -235,6 +235,7 @@ async fn create_and_list_authorities_by_kind(pool: PgPool) {
let json: serde_json::Value = let json: serde_json::Value =
serde_json::from_slice(&list.into_body().collect().await.unwrap().to_bytes()).unwrap(); serde_json::from_slice(&list.into_body().collect().await.unwrap().to_bytes()).unwrap();
assert_eq!(json.as_array().unwrap().len(), 1); assert_eq!(json.as_array().unwrap().len(), 1);
assert_eq!(json[0]["kind"], "person"); assert_eq!(json[0]["kind"], "person");
@@ -250,9 +251,11 @@ async fn create_and_list_authorities_by_kind(pool: PgPool) {
) )
.await .await
.unwrap(); .unwrap();
assert_eq!(places.status(), StatusCode::OK);
let places_json: serde_json::Value = let places_json: serde_json::Value =
serde_json::from_slice(&places.into_body().collect().await.unwrap().to_bytes()).unwrap(); serde_json::from_slice(&places.into_body().collect().await.unwrap().to_bytes()).unwrap();
assert!(places_json.as_array().unwrap().is_empty()); assert!(places_json.as_array().unwrap().is_empty());
// bad kind → 422 // bad kind → 422