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

Function properties_add

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

Source from the content-addressed store, hash-verified

531
532#[tokio::test]
533async fn properties_add() {
534 let mut database = DatabaseTestWrapper::new().await;
535 let mut api = seed(&mut database).await;
536
537 let entity = api
538 .create_entity(
539 api.account_id,
540 CreateEntityParams {
541 web_id: WebId::new(api.account_id),
542 entity_uuid: None,
543 decision_time: None,
544 entity_type_ids: HashSet::from([person_entity_type_id()]),
545 properties: PropertyObjectWithMetadata::from_parts(alice(), None)
546 .expect("could not create property with metadata object"),
547 confidence: None,
548 link_data: None,
549 draft: false,
550 policies: Vec::new(),
551 provenance: ProvidedEntityEditionProvenance {
552 actor_type: ActorType::User,
553 origin: OriginProvenance::from_empty_type(OriginType::Api),
554 sources: Vec::new(),
555 },
556 read_only: false,
557 },
558 )
559 .await
560 .expect("could not create entity");
561 let entity_id = entity.metadata.record_id.entity_id;
562
563 let path: PropertyPath = once(PropertyPathElement::from(age_property_type_id())).collect();
564 let updated_entity = api
565 .patch_entity(
566 api.account_id,
567 PatchEntityParams {
568 entity_id,
569 decision_time: None,
570 entity_type_ids: HashSet::new(),
571 properties: vec![PropertyPatchOperation::Add {
572 path: path.clone(),
573 property: PropertyWithMetadata::Value(PropertyValueWithMetadata {
574 value: PropertyValue::Number(Real::from(30)),
575 metadata: ValueMetadata {
576 confidence: Confidence::new(0.5),
577 data_type_id: None,
578 original_data_type_id: None,
579 provenance: ValueProvenance::default(),
580 canonical: HashMap::default(),
581 },
582 }),
583 }],
584 draft: None,
585 archived: None,
586 confidence: None,
587 provenance: ProvidedEntityEditionProvenance {
588 actor_type: ActorType::User,
589 origin: OriginProvenance::from_empty_type(OriginType::Api),
590 sources: Vec::new(),

Callers

nothing calls this directly

Calls 9

create_entityMethod · 0.80
collectMethod · 0.80
seedFunction · 0.70
person_entity_type_idFunction · 0.70
aliceFunction · 0.70
age_property_type_idFunction · 0.70
fromFunction · 0.50
expectMethod · 0.45
patch_entityMethod · 0.45

Tested by

no test coverage detected