()
| 270 | #[tokio::test] |
| 271 | #[expect(clippy::too_many_lines)] |
| 272 | async fn no_initial_draft() { |
| 273 | let mut database = DatabaseTestWrapper::new().await; |
| 274 | let mut api = seed(&mut database).await; |
| 275 | |
| 276 | let entity = api |
| 277 | .create_entity( |
| 278 | api.account_id, |
| 279 | CreateEntityParams { |
| 280 | web_id: WebId::new(api.account_id), |
| 281 | entity_uuid: None, |
| 282 | decision_time: None, |
| 283 | entity_type_ids: HashSet::from([person_entity_type_id()]), |
| 284 | properties: PropertyObjectWithMetadata::from_parts(alice(), None) |
| 285 | .expect("could not create property with metadata object"), |
| 286 | confidence: None, |
| 287 | link_data: None, |
| 288 | draft: false, |
| 289 | policies: Vec::new(), |
| 290 | provenance: ProvidedEntityEditionProvenance { |
| 291 | actor_type: ActorType::User, |
| 292 | origin: OriginProvenance::from_empty_type(OriginType::Api), |
| 293 | sources: Vec::new(), |
| 294 | }, |
| 295 | read_only: false, |
| 296 | }, |
| 297 | ) |
| 298 | .await |
| 299 | .expect("could not create entity"); |
| 300 | assert!(entity.metadata.record_id.entity_id.draft_id.is_none()); |
| 301 | assert!(check_entity_exists(&api, entity.metadata.record_id.entity_id).await); |
| 302 | |
| 303 | let ClosedTemporalBound::Inclusive(undraft_transaction_time) = |
| 304 | entity.metadata.temporal_versioning.transaction_time.start(); |
| 305 | let ClosedTemporalBound::Inclusive(undraft_decision_time) = |
| 306 | entity.metadata.temporal_versioning.decision_time.start(); |
| 307 | assert_eq!( |
| 308 | entity |
| 309 | .metadata |
| 310 | .provenance |
| 311 | .inferred |
| 312 | .first_non_draft_created_at_transaction_time, |
| 313 | Some(*undraft_transaction_time) |
| 314 | ); |
| 315 | assert_eq!( |
| 316 | entity |
| 317 | .metadata |
| 318 | .provenance |
| 319 | .inferred |
| 320 | .first_non_draft_created_at_decision_time, |
| 321 | Some(*undraft_decision_time) |
| 322 | ); |
| 323 | |
| 324 | for _ in 0..5 { |
| 325 | let updated_entity = api |
| 326 | .patch_entity( |
| 327 | api.account_id, |
| 328 | PatchEntityParams { |
| 329 | entity_id: entity.metadata.record_id.entity_id, |
nothing calls this directly
no test coverage detected