()
| 83 | #[tokio::test] |
| 84 | #[expect(clippy::too_many_lines)] |
| 85 | async fn properties_add() { |
| 86 | let mut database = DatabaseTestWrapper::new().await; |
| 87 | let mut api = seed(&mut database).await; |
| 88 | |
| 89 | let entity = api |
| 90 | .create_entity( |
| 91 | api.account_id, |
| 92 | CreateEntityParams { |
| 93 | web_id: WebId::new(api.account_id), |
| 94 | entity_uuid: None, |
| 95 | decision_time: None, |
| 96 | entity_type_ids: HashSet::from([person_entity_type_id()]), |
| 97 | properties: PropertyObjectWithMetadata::from_parts(alice(), None) |
| 98 | .expect("could not create property with metadata object"), |
| 99 | confidence: None, |
| 100 | link_data: None, |
| 101 | draft: false, |
| 102 | policies: Vec::new(), |
| 103 | provenance: ProvidedEntityEditionProvenance { |
| 104 | actor_type: ActorType::User, |
| 105 | origin: OriginProvenance::from_empty_type(OriginType::Api), |
| 106 | sources: Vec::new(), |
| 107 | }, |
| 108 | read_only: false, |
| 109 | }, |
| 110 | ) |
| 111 | .await |
| 112 | .expect("could not create entity"); |
| 113 | let entity_id = entity.metadata.record_id.entity_id; |
| 114 | |
| 115 | api.patch_entity( |
| 116 | api.account_id, |
| 117 | PatchEntityParams { |
| 118 | entity_id, |
| 119 | decision_time: None, |
| 120 | entity_type_ids: HashSet::new(), |
| 121 | properties: vec![ |
| 122 | PropertyPatchOperation::Add { |
| 123 | path: once(PropertyPathElement::from(age_property_type_id())).collect(), |
| 124 | property: PropertyWithMetadata::Value(PropertyValueWithMetadata { |
| 125 | value: PropertyValue::Number(Real::from(30)), |
| 126 | metadata: ValueMetadata { |
| 127 | confidence: None, |
| 128 | data_type_id: None, |
| 129 | original_data_type_id: None, |
| 130 | provenance: ValueProvenance::default(), |
| 131 | canonical: HashMap::default(), |
| 132 | }, |
| 133 | }), |
| 134 | }, |
| 135 | PropertyPatchOperation::Add { |
| 136 | path: once(PropertyPathElement::from(name_property_type_id())).collect(), |
| 137 | property: PropertyWithMetadata::Value(PropertyValueWithMetadata { |
| 138 | value: PropertyValue::String("Alice Allison".to_owned()), |
| 139 | metadata: ValueMetadata { |
| 140 | confidence: None, |
| 141 | data_type_id: None, |
| 142 | original_data_type_id: None, |
nothing calls this directly
no test coverage detected