| 23 | #[tokio::test] |
| 24 | #[expect(clippy::too_many_lines)] |
| 25 | async fn insert() { |
| 26 | let mut database = DatabaseTestWrapper::new().await; |
| 27 | let mut api = database |
| 28 | .seed( |
| 29 | [ |
| 30 | data_type::VALUE_V1, |
| 31 | data_type::TEXT_V1, |
| 32 | data_type::NUMBER_V1, |
| 33 | ], |
| 34 | [ |
| 35 | property_type::NAME_V1, |
| 36 | property_type::AGE_V1, |
| 37 | property_type::FAVORITE_SONG_V1, |
| 38 | property_type::FAVORITE_FILM_V1, |
| 39 | property_type::HOBBY_V1, |
| 40 | property_type::INTERESTS_V1, |
| 41 | ], |
| 42 | [ |
| 43 | entity_type::LINK_V1, |
| 44 | entity_type::link::FRIEND_OF_V1, |
| 45 | entity_type::link::ACQUAINTANCE_OF_V1, |
| 46 | entity_type::PERSON_V1, |
| 47 | ], |
| 48 | ) |
| 49 | .await |
| 50 | .expect("could not seed database"); |
| 51 | |
| 52 | let web_id = WebId::new(api.account_id); |
| 53 | |
| 54 | let alice_id = EntityUuid::new(Uuid::new_v4()); |
| 55 | let alice_entity = CreateEntityParams { |
| 56 | web_id, |
| 57 | entity_uuid: Some(alice_id), |
| 58 | decision_time: None, |
| 59 | entity_type_ids: HashSet::from([VersionedUrl::from_str( |
| 60 | "https://blockprotocol.org/@alice/types/entity-type/person/v/1", |
| 61 | ) |
| 62 | .expect("couldn't construct Versioned URL")]), |
| 63 | properties: PropertyObjectWithMetadata::from_parts( |
| 64 | serde_json::from_str(entity::PERSON_ALICE_V1).expect("could not parse entity"), |
| 65 | None, |
| 66 | ) |
| 67 | .expect("could not create property with metadata object"), |
| 68 | confidence: None, |
| 69 | link_data: None, |
| 70 | draft: false, |
| 71 | policies: Vec::new(), |
| 72 | provenance: ProvidedEntityEditionProvenance { |
| 73 | actor_type: ActorType::User, |
| 74 | origin: OriginProvenance::from_empty_type(OriginType::Api), |
| 75 | sources: Vec::new(), |
| 76 | }, |
| 77 | read_only: false, |
| 78 | }; |
| 79 | |
| 80 | let bob_id = EntityUuid::new(Uuid::new_v4()); |
| 81 | let bob_entity = CreateEntityParams { |
| 82 | web_id, |