()
| 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() { |
nothing calls this directly
no test coverage detected