use port_sdk::types::filters::FilterBuilder;
use port_sdk::types::ids::{BlueprintId, EntityId};
use port_sdk::types::IdentifiedResource;
use port_sdk::types::{blueprints::BlueprintDefinition, entities::EntityRequest};
use serde_json::json;
#[test]
fn filter_builder_serializes_expected_keys() {
let filters =
FilterBuilder::new().eq("properties.owner", "team-a").contains("title", "service").build();
assert_eq!(filters["filter[properties.owner][eq]"], "team-a");
assert_eq!(filters["filter[title][contains]"], "service");
}
#[test]
fn identifiers_wrap_strings_safely() {
let blueprint_id: BlueprintId = "bp".into();
let entity_id: EntityId = "entity".into();
let blueprint = BlueprintDefinition::new(blueprint_id.clone(), "Title");
assert_eq!(blueprint.identifier(), blueprint_id.as_str());
let entity = EntityRequest::new(entity_id.clone(), blueprint_id, Some(json!({"env": "prod"})));
assert_eq!(entity.identifier(), entity_id.as_str());
}