Skip to content

Commit bd7aae3

Browse files
committed
Add test for setting rotation mode
1 parent 7461251 commit bd7aae3

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/db/review_prefs.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use postgres_types::{to_sql_checked, FromSql, IsNull, ToSql, Type};
66
use std::collections::HashMap;
77
use std::error::Error;
88

9-
#[derive(Debug, Default, Copy, Clone)]
9+
#[derive(Debug, Default, Copy, Clone, PartialEq)]
1010
pub enum RotationMode {
1111
/// The reviewer can be automatically assigned by triagebot,
1212
/// and they can be assigned through teams and assign groups.
@@ -243,4 +243,26 @@ mod tests {
243243
})
244244
.await;
245245
}
246+
247+
#[tokio::test]
248+
async fn set_rotation_mode() {
249+
run_db_test(|ctx| async {
250+
let db = ctx.db_client();
251+
let user = user("Martin", 1);
252+
253+
upsert_review_prefs(&db, user.clone(), Some(5), RotationMode::OnRotation).await?;
254+
assert_eq!(
255+
get_review_prefs(&db, 1).await?.unwrap().rotation_mode,
256+
RotationMode::OnRotation
257+
);
258+
upsert_review_prefs(&db, user.clone(), Some(10), RotationMode::OffRotation).await?;
259+
assert_eq!(
260+
get_review_prefs(&db, 1).await?.unwrap().rotation_mode,
261+
RotationMode::OffRotation
262+
);
263+
264+
Ok(ctx)
265+
})
266+
.await;
267+
}
246268
}

0 commit comments

Comments
 (0)