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

Function properties_remove

tests/graph/integration/postgres/partial_updates.rs:197–273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

195
196#[tokio::test]
197async fn properties_remove() {
198 let mut database = DatabaseTestWrapper::new().await;
199 let mut api = seed(&mut database).await;
200
201 let entity = api
202 .create_entity(
203 api.account_id,
204 CreateEntityParams {
205 web_id: WebId::new(api.account_id),
206 entity_uuid: None,
207 decision_time: None,
208 entity_type_ids: HashSet::from([person_entity_type_id()]),
209 properties: PropertyObjectWithMetadata::from_parts(alice(), None)
210 .expect("could not create property with metadata object"),
211 confidence: None,
212 link_data: None,
213 draft: false,
214 policies: Vec::new(),
215 provenance: ProvidedEntityEditionProvenance {
216 actor_type: ActorType::User,
217 origin: OriginProvenance::from_empty_type(OriginType::Api),
218 sources: Vec::new(),
219 },
220 read_only: false,
221 },
222 )
223 .await
224 .expect("could not create entity");
225 let entity_id = entity.metadata.record_id.entity_id;
226
227 api.patch_entity(
228 api.account_id,
229 PatchEntityParams {
230 entity_id,
231 decision_time: None,
232 entity_type_ids: HashSet::new(),
233 properties: vec![PropertyPatchOperation::Remove {
234 path: once(PropertyPathElement::from(name_property_type_id())).collect(),
235 }],
236 draft: None,
237 archived: None,
238 confidence: None,
239 provenance: ProvidedEntityEditionProvenance {
240 actor_type: ActorType::User,
241 origin: OriginProvenance::from_empty_type(OriginType::Api),
242 sources: Vec::new(),
243 },
244 },
245 )
246 .await
247 .expect("could not patch entity");
248
249 let entities = Box::pin(api.query_entities(
250 api.account_id,
251 QueryEntitiesParams {
252 filter: Filter::for_entity_by_entity_id(entity_id),
253 temporal_axes: QueryTemporalAxesUnresolved::live_only(),
254 sorting: EntityQuerySorting {

Callers

nothing calls this directly

Calls 13

create_entityMethod · 0.80
unwrapMethod · 0.80
seedFunction · 0.70
person_entity_type_idFunction · 0.70
aliceFunction · 0.70
fromFunction · 0.50
for_entity_by_entity_idFunction · 0.50
expectMethod · 0.45
patch_entityMethod · 0.45
query_entitiesMethod · 0.45
nextMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected