acp: Add e2e test support for NativeAgent (#36635)
Release Notes: - N/A
This commit is contained in:
parent
6f242772cc
commit
568e1d0a42
8 changed files with 172 additions and 36 deletions
|
@ -10,6 +10,7 @@ path = "src/agent2.rs"
|
|||
|
||||
[features]
|
||||
test-support = ["db/test-support"]
|
||||
e2e = []
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -72,6 +73,7 @@ zstd.workspace = true
|
|||
|
||||
[dev-dependencies]
|
||||
agent = { workspace = true, "features" = ["test-support"] }
|
||||
agent_servers = { workspace = true, "features" = ["test-support"] }
|
||||
assistant_context = { workspace = true, "features" = ["test-support"] }
|
||||
ctor.workspace = true
|
||||
client = { workspace = true, "features" = ["test-support"] }
|
||||
|
|
|
@ -73,3 +73,52 @@ impl AgentServer for NativeAgentServer {
|
|||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use assistant_context::ContextStore;
|
||||
use gpui::AppContext;
|
||||
|
||||
agent_servers::e2e_tests::common_e2e_tests!(
|
||||
async |fs, project, cx| {
|
||||
let auth = cx.update(|cx| {
|
||||
prompt_store::init(cx);
|
||||
terminal::init(cx);
|
||||
|
||||
let registry = language_model::LanguageModelRegistry::read_global(cx);
|
||||
let auth = registry
|
||||
.provider(&language_model::ANTHROPIC_PROVIDER_ID)
|
||||
.unwrap()
|
||||
.authenticate(cx);
|
||||
|
||||
cx.spawn(async move |_| auth.await)
|
||||
});
|
||||
|
||||
auth.await.unwrap();
|
||||
|
||||
cx.update(|cx| {
|
||||
let registry = language_model::LanguageModelRegistry::global(cx);
|
||||
|
||||
registry.update(cx, |registry, cx| {
|
||||
registry.select_default_model(
|
||||
Some(&language_model::SelectedModel {
|
||||
provider: language_model::ANTHROPIC_PROVIDER_ID,
|
||||
model: language_model::LanguageModelId("claude-sonnet-4-latest".into()),
|
||||
}),
|
||||
cx,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
let history = cx.update(|cx| {
|
||||
let context_store = cx.new(move |cx| ContextStore::fake(project.clone(), cx));
|
||||
cx.new(move |cx| HistoryStore::new(context_store, cx))
|
||||
});
|
||||
|
||||
NativeAgentServer::new(fs.clone(), history)
|
||||
},
|
||||
allow_option_id = "allow"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue