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

Function initial_metadata

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

Source from the content-addressed store, hash-verified

150#[tokio::test]
151#[expect(clippy::too_many_lines)]
152async 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 {

Callers

nothing calls this directly

Calls 13

property_provenance_aFunction · 0.85
edition_provenanceFunction · 0.85
create_entityMethod · 0.80
seedFunction · 0.70
name_property_type_idFunction · 0.70
person_entity_type_idFunction · 0.70
aliceFunction · 0.70
fromFunction · 0.50
ValueEnum · 0.50
defaultFunction · 0.50
expectMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected