diff --git a/tests/string_primary_key_tests.rs b/tests/string_primary_key_tests.rs index 94d1ae554c..569f1cc09f 100644 --- a/tests/string_primary_key_tests.rs +++ b/tests/string_primary_key_tests.rs @@ -2,7 +2,7 @@ pub mod common; pub use common::{features::*, setup::*, TestContext}; use pretty_assertions::assert_eq; -use sea_orm::{entity::prelude::*, entity::*, DatabaseConnection}; +use sea_orm::{entity::prelude::*, entity::*, sea_query::OnConflict, DatabaseConnection}; use serde_json::json; #[sea_orm_macros::test] @@ -30,7 +30,7 @@ pub async fn insert_and_delete_repository(db: &DatabaseConnection) -> Result<(), } .into_active_model(); - let result = repository.insert(db).await?; + let result = repository.clone().insert(db).await?; assert_eq!( result, @@ -42,6 +42,13 @@ pub async fn insert_and_delete_repository(db: &DatabaseConnection) -> Result<(), } ); + let err = Repository::insert(repository) + .on_conflict(OnConflict::new().do_nothing().to_owned()) + .exec(db) + .await; + + assert_eq!(err.err(), Some(DbErr::RecordNotInserted)); + result.delete(db).await?; assert_eq!(