Daniel Karzel
3 years ago
committed by
Thomas Eizinger
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
1 changed files with
15 additions and
0 deletions
-
daemon/src/db.rs
|
|
@ -704,6 +704,21 @@ mod tests { |
|
|
|
assert_eq!(vec![cfd_1, cfd_2], cfds_from_db); |
|
|
|
} |
|
|
|
|
|
|
|
#[tokio::test] |
|
|
|
async fn test_insert_order_without_cfd_associates_with_correct_cfd() { |
|
|
|
let mut conn = setup_test_db().await; |
|
|
|
|
|
|
|
// Insert an order without a CFD
|
|
|
|
let _order_1 = Order::dummy().insert(&mut conn).await; |
|
|
|
|
|
|
|
// Insert a CFD (this also inserts an order)
|
|
|
|
let cfd_1 = Cfd::dummy().insert(&mut conn).await; |
|
|
|
|
|
|
|
let all_cfds = load_all_cfds(&mut conn).await.unwrap(); |
|
|
|
|
|
|
|
assert_eq!(all_cfds, vec![cfd_1]); |
|
|
|
} |
|
|
|
|
|
|
|
// test more data; test will add 100 cfds to the database, with each
|
|
|
|
// having a random number of random updates. Final results are deterministic.
|
|
|
|
#[tokio::test] |
|
|
|