Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hocuri committed Jan 14, 2025
1 parent 6e4fde9 commit a053ce0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/sql/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,3 +1224,25 @@ impl Sql {
Ok(())
}
}

#[cfg(test)]
mod tests {
use crate::config::Config;
use crate::test_utils::TestContext;

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_clear_config_cache() -> anyhow::Result<()> {
let t = TestContext::new().await;
assert_eq!(t.get_config_bool(Config::IsChatmail).await?, false);

t.sql
.execute_migration(
"INSERT INTO config (keyname, value) VALUES ('is_chatmail', '1')",
1000,
)
.await?;
assert_eq!(t.get_config_bool(Config::IsChatmail).await?, true);

Ok(())
}
}

0 comments on commit a053ce0

Please sign in to comment.