MCPcopy Create free account
hub / github.com/hashintel/hash / no_initial_metadata

Function no_initial_metadata

tests/graph/integration/postgres/property_metadata.rs:312–530  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310#[tokio::test]
311#[expect(clippy::too_many_lines)]
312async fn no_initial_metadata() {
313 let mut database = DatabaseTestWrapper::new().await;
314 let mut api = seed(&mut database).await;
315
316 let entity = api
317 .create_entity(
318 api.account_id,
319 CreateEntityParams {
320 web_id: WebId::new(api.account_id),
321 entity_uuid: None,
322 decision_time: None,
323 entity_type_ids: HashSet::from([person_entity_type_id()]),
324 properties: PropertyObjectWithMetadata::from_parts(alice(), None)
325 .expect("could not create property with metadata object"),
326 confidence: None,
327 link_data: None,
328 draft: false,
329 policies: Vec::new(),
330 provenance: ProvidedEntityEditionProvenance {
331 actor_type: ActorType::User,
332 origin: OriginProvenance::from_empty_type(OriginType::Api),
333 sources: Vec::new(),
334 },
335 read_only: false,
336 },
337 )
338 .await
339 .expect("could not create entity");
340
341 assert!(entity.metadata.confidence.is_none());
342 assert_eq!(
343 entity.metadata.properties,
344 PropertyObjectMetadata {
345 value: HashMap::from([(
346 name_property_type_id(),
347 PropertyMetadata::Value(PropertyValueMetadata {
348 metadata: ValueMetadata {
349 provenance: ValueProvenance::default(),
350 confidence: None,
351 data_type_id: Some(text_data_type_id()),
352 original_data_type_id: Some(text_data_type_id()),
353 canonical: HashMap::from([(
354 text_data_type_id().base_url,
355 PropertyValue::String("Alice".to_owned())
356 )]),
357 },
358 }),
359 )]),
360 metadata: ObjectMetadata::default(),
361 }
362 );
363
364 let updated_entity = api
365 .patch_entity(
366 api.account_id,
367 PatchEntityParams {
368 entity_id: entity.metadata.record_id.entity_id,
369 properties: Vec::new(),

Callers

nothing calls this directly

Calls 8

edition_provenanceFunction · 0.85
create_entityMethod · 0.80
seedFunction · 0.70
person_entity_type_idFunction · 0.70
aliceFunction · 0.70
fromFunction · 0.50
expectMethod · 0.45
patch_entityMethod · 0.45

Tested by

no test coverage detected