()
| 150 | #[tokio::test] |
| 151 | #[expect(clippy::too_many_lines)] |
| 152 | async fn initial_metadata() { |
| 153 | let mut database = DatabaseTestWrapper::new().await; |
| 154 | let mut api = seed(&mut database).await; |
| 155 | |
| 156 | let entity_property_metadata = PropertyObjectMetadata { |
| 157 | value: HashMap::from([( |
| 158 | name_property_type_id(), |
| 159 | PropertyMetadata::Value(PropertyValueMetadata { |
| 160 | metadata: ValueMetadata { |
| 161 | provenance: property_provenance_a(), |
| 162 | confidence: Confidence::new(0.5), |
| 163 | data_type_id: None, |
| 164 | original_data_type_id: None, |
| 165 | canonical: HashMap::default(), |
| 166 | }, |
| 167 | }), |
| 168 | )]), |
| 169 | metadata: ObjectMetadata { |
| 170 | provenance: PropertyProvenance::default(), |
| 171 | confidence: Confidence::new(0.8), |
| 172 | }, |
| 173 | }; |
| 174 | |
| 175 | let entity = api |
| 176 | .create_entity( |
| 177 | api.account_id, |
| 178 | CreateEntityParams { |
| 179 | web_id: WebId::new(api.account_id), |
| 180 | entity_uuid: None, |
| 181 | decision_time: None, |
| 182 | entity_type_ids: HashSet::from([person_entity_type_id()]), |
| 183 | properties: PropertyObjectWithMetadata::from_parts( |
| 184 | alice(), |
| 185 | Some(entity_property_metadata.clone()), |
| 186 | ) |
| 187 | .expect("could not create property with metadata object"), |
| 188 | confidence: Confidence::new(0.5), |
| 189 | link_data: None, |
| 190 | draft: true, |
| 191 | policies: Vec::new(), |
| 192 | provenance: ProvidedEntityEditionProvenance { |
| 193 | actor_type: ActorType::User, |
| 194 | origin: OriginProvenance::from_empty_type(OriginType::Api), |
| 195 | sources: Vec::new(), |
| 196 | }, |
| 197 | read_only: false, |
| 198 | }, |
| 199 | ) |
| 200 | .await |
| 201 | .expect("could not create entity"); |
| 202 | |
| 203 | assert_eq!(entity.metadata.confidence, Confidence::new(0.5)); |
| 204 | assert_eq!( |
| 205 | entity.metadata.properties, |
| 206 | PropertyObjectMetadata { |
| 207 | value: HashMap::from([( |
| 208 | name_property_type_id(), |
| 209 | PropertyMetadata::Value(PropertyValueMetadata { |
nothing calls this directly
no test coverage detected