diff options
Diffstat (limited to '')
| -rw-r--r-- | tests/sessions.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/sessions.rs b/tests/sessions.rs index f21be24..1d40f64 100644 --- a/tests/sessions.rs +++ b/tests/sessions.rs | |||
| @@ -95,3 +95,18 @@ fn a_session_cannot_be_open_twice() { | |||
| 95 | drop(first); | 95 | drop(first); |
| 96 | Session::open("locked").expect("after the first handle closes it is available"); | 96 | Session::open("locked").expect("after the first handle closes it is available"); |
| 97 | } | 97 | } |
| 98 | |||
| 99 | #[test] | ||
| 100 | fn listing_reports_the_model_in_use_after_a_switch() { | ||
| 101 | let _env = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner()); | ||
| 102 | let dir = temp_dir("model-switch"); | ||
| 103 | std::env::set_var("AGENT686_DATA", &dir); | ||
| 104 | |||
| 105 | let system = json!({ "role": "system", "content": "x" }); | ||
| 106 | let mut session = Session::create_as("switch".into(), "model-a", &system).unwrap(); | ||
| 107 | session.record_model("model-b").unwrap(); | ||
| 108 | |||
| 109 | let listed = session::list().unwrap(); | ||
| 110 | assert_eq!(listed.len(), 1); | ||
| 111 | assert_eq!(listed[0].model, "model-b"); | ||
| 112 | } | ||
