backstage-client 0.1.4

A Rust client library for interacting with the Backstage Catalog API. Provides type-safe access to Backstage entities with async support, filtering, and comprehensive error handling.
Documentation
use super::{common::Entity, component::Component};
use log::Metadata;
use tokio;

#[tokio::test]
async fn test_component_deserialization() {
    let json_data = r#"
        {
            "apiVersion": "backstage.io/v1alpha1",
            "kind": "Component",
            "metadata": {
                "name": "test-component",
                "description": "A sample component"
            }
        }
    "#;

    // Deserialize the Component struct from JSON
    let component: Component = serde_json::from_str(json_data).unwrap();

    assert_eq!(component.metadata.name, "test-component");
    assert_eq!(
        component.metadata.description,
        Some("A sample component".to_string())
    );
}

#[tokio::test]
async fn test_entity_struct_deserialization() {
    let json_data = r#"
        {
            "apiVersion": "backstage.io/v1alpha1",
            "kind": "Component",
            "metadata": {
                "name": "test-component"
            }
        }
    "#;

    // Deserialize the generic Entity struct from JSON
    let entity: Entity = serde_json::from_str(json_data).unwrap();

    assert_eq!(entity.metadata.name, "test-component");
}