MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / host

Function host

libatomic/tests/review_service_test.rs:14–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12use tonic::{Code, Request};
13
14fn host() -> (
15 tempfile::TempDir,
16 PathBuf,
17 Arc<DaemonState>,
18 RepositoryRef,
19 String,
20 String,
21) {
22 let dir = tempfile::tempdir().unwrap();
23 let root = dir.path().join("repo");
24 let mut repo = Repository::init(&root).unwrap();
25 repo.init_vault().unwrap();
26 let base = repo.current_view().to_string();
27 let wc = repo.require_working_copy_id().unwrap();
28 std::fs::write(root.join("lib.rs"), "pub fn work() {}\n").unwrap();
29 repo.add(wc, "lib.rs", TrackingOptions::default()).unwrap();
30 let record = |repo: &Repository| {
31 repo.record(
32 wc,
33 ChangeHeader::new("review fixture"),
34 RecordOptions::new().with_all(true).enrich_kg(false),
35 )
36 .unwrap()
37 };
38 record(&repo);
39 repo.create_draft_view("candidate", &base).unwrap();
40 repo.switch_view(wc, "candidate").unwrap();
41 std::fs::write(root.join("lib.rs"), "pub fn work() { todo!(); }\n").unwrap();
42 let change = record(&repo).hash().to_base32();
43 drop(repo);
44 let root = root.canonicalize().unwrap();
45 let state = Arc::new(DaemonState::new());
46 let reference = state.register(root.clone()).repository_ref();
47 (dir, root, state, reference, base, change)
48}
49
50fn options(request: &GenerateReviewRequest) -> ReviewRequest {
51 ReviewRequest {

Calls 15

enrich_kgMethod · 0.80
create_draft_viewMethod · 0.80
canonicalizeMethod · 0.80
repository_refMethod · 0.80
writeFunction · 0.70
recordFunction · 0.70
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
init_vaultMethod · 0.45
current_viewMethod · 0.45

Tested by

no test coverage detected