ZIm/crates/collab/src/llm/db/tests/provider_tests.rs
2025-07-31 16:18:47 +00:00

31 lines
800 B
Rust

use pretty_assertions::assert_eq;
use zed_llm_client::LanguageModelProvider;
use crate::llm::db::LlmDatabase;
use crate::test_llm_db;
test_llm_db!(
test_initialize_providers,
test_initialize_providers_postgres
);
async fn test_initialize_providers(db: &mut LlmDatabase) {
let initial_providers = db.list_providers().await.unwrap();
assert_eq!(initial_providers, vec![]);
db.initialize_providers().await.unwrap();
// Do it twice, to make sure the operation is idempotent.
db.initialize_providers().await.unwrap();
let providers = db.list_providers().await.unwrap();
assert_eq!(
providers,
&[
LanguageModelProvider::Anthropic,
LanguageModelProvider::Google,
LanguageModelProvider::OpenAi,
]
)
}