MCPcopy Create free account
hub / github.com/dfinity/orbit / create_entry

Function create_entry

core/station/impl/src/services/address_book.rs:202–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

200
201 #[tokio::test]
202 async fn create_entry() {
203 let ctx = setup();
204 let mut address_book_entry = mock_address_book_entry();
205
206 let operation = AddAddressBookEntryOperation {
207 address_book_entry_id: None,
208 input: AddAddressBookEntryOperationInput {
209 address_owner: "foo".to_string(),
210 address: "0x1234".to_string(),
211 blockchain: Blockchain::InternetComputer,
212 metadata: address_book_entry.metadata.clone().into(),
213 labels: vec![],
214 address_format: AddressFormat::ICPAccountIdentifier,
215 },
216 };
217
218 let result = ctx.service.create_entry(operation.input.clone()).await;
219
220 let new_entry = result.unwrap();
221
222 address_book_entry.id = new_entry.id;
223 address_book_entry.last_modification_timestamp = new_entry.last_modification_timestamp;
224
225 assert_eq!(new_entry, address_book_entry);
226
227 // adding a new entry for the same address should fail
228
229 let result = ctx.service.create_entry(operation.input).await;
230
231 result.unwrap_err();
232 }
233
234 #[tokio::test]
235 async fn edit_entry() {

Callers

nothing calls this directly

Calls 3

mock_address_book_entryFunction · 0.85
create_entryMethod · 0.80
setupFunction · 0.70

Tested by

no test coverage detected