Now returning duplicate database errors.

This commit is contained in:
2023-06-30 22:38:18 -04:00
parent e73fdbff75
commit c70c006abd
2 changed files with 22 additions and 1 deletions

View File

@ -146,6 +146,24 @@ mod mtt {
let output = mtt1.session().await.unwrap();
assert_eq!(output.list(), [db1, db2]);
}
#[async_std::test]
async fn fail_on_duplicates() {
let dir = tempdir().unwrap();
let mtt1 = start_db(dir.path()).await.unwrap();
let mtt2 = mtt1.clone();
let name = "unique_only";
let mut store1 = mtt1.session().await.unwrap();
let mut store2 = mtt2.session().await.unwrap();
store1.add(name).unwrap();
store2.add(name).unwrap();
mtt1.commit(store1).await.unwrap();
let output = mtt2.commit(store2).await;
match output {
Ok(_) => assert!(false, "Should have returned an error"),
Err(_) => (),
}
}
}
pub async fn start_db<P>(dir: P) -> Result<MoreThanText, MTTError>