37 lines
1.1 KiB
Rust
37 lines
1.1 KiB
Rust
use sea_orm::DbConn;
|
|
|
|
pub mod bakery_chain;
|
|
mod setup;
|
|
pub use bakery_chain::*;
|
|
mod crud;
|
|
mod schema;
|
|
|
|
#[async_std::test]
|
|
// cargo test --test bakery_chain_tests -- --nocapture
|
|
async fn main() {
|
|
let db: DbConn = setup::setup().await;
|
|
setup_schema(&db).await;
|
|
create_entities(&db).await;
|
|
}
|
|
|
|
async fn setup_schema(db: &DbConn) {
|
|
assert!(schema::create_bakery_table(db).await.is_ok());
|
|
assert!(schema::create_baker_table(db).await.is_ok());
|
|
assert!(schema::create_customer_table(db).await.is_ok());
|
|
assert!(schema::create_order_table(db).await.is_ok());
|
|
assert!(schema::create_lineitem_table(db).await.is_ok());
|
|
assert!(schema::create_cake_table(db).await.is_ok());
|
|
assert!(schema::create_cakes_bakers_table(db).await.is_ok());
|
|
}
|
|
|
|
async fn create_entities(db: &DbConn) {
|
|
crud::test_create_bakery(db).await;
|
|
crud::test_create_baker(db).await;
|
|
crud::test_create_customer(db).await;
|
|
crud::create_cake::test_create_cake(db).await;
|
|
crud::create_lineitem::test_create_lineitem(db).await;
|
|
crud::create_order::test_create_order(db).await;
|
|
|
|
crud::updates::test_update_cake(db).await;
|
|
}
|