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

Function host

libatomic/tests/triage_service_test.rs:36–87  ·  view source on GitHub ↗

A repository with one change on `dev` and one on a draft `feat`.

()

Source from the content-addressed store, hash-verified

34
35/// A repository with one change on `dev` and one on a draft `feat`.
36fn host() -> (TempDir, std::path::PathBuf, Arc<DaemonState>, RepositoryRef) {
37 let dir = TempDir::new().unwrap();
38 let root = dir.path().join("repo");
39 {
40 let mut repo = Repository::init(&root).unwrap();
41 let working_copy = repo.require_working_copy_id().unwrap();
42 write(&root, "README.md", "hello\n");
43 repo.add(working_copy, "README.md", TrackingOptions::default())
44 .unwrap();
45 let header = ChangeHeader::builder()
46 .message("first")
47 .author(Author::new("Test", Some("test@example.com")))
48 .build();
49 let outcome = repo
50 .record(
51 working_copy,
52 header,
53 RecordOptions::new()
54 .with_all(true)
55 .save_to_store(true)
56 .apply_after_record(true),
57 )
58 .unwrap();
59 assert!(outcome.was_applied());
60
61 repo.create_view_from("feat", "dev").unwrap();
62 repo.switch_view(working_copy, "feat").unwrap();
63 write(&root, "src/lib.rs", "pub fn f() {}\n");
64 repo.add(working_copy, "src/lib.rs", TrackingOptions::default())
65 .unwrap();
66 let header = ChangeHeader::builder()
67 .message("a feature")
68 .author(Author::new("Test", Some("test@example.com")))
69 .build();
70 let outcome = repo
71 .record(
72 working_copy,
73 header,
74 RecordOptions::new()
75 .with_all(true)
76 .save_to_store(true)
77 .apply_after_record(true),
78 )
79 .unwrap();
80 assert!(outcome.was_applied());
81 repo.switch_view(working_copy, "dev").unwrap();
82 }
83 let state = Arc::new(DaemonState::new());
84 let root = root.canonicalize().unwrap();
85 let repository = state.register(root.clone()).repository_ref();
86 (dir, root, state, repository)
87}
88
89#[tokio::test]
90async fn the_review_arrives_as_the_wire_report_shape() {

Calls 15

authorMethod · 0.80
apply_after_recordMethod · 0.80
save_to_storeMethod · 0.80
create_view_fromMethod · 0.80
canonicalizeMethod · 0.80
repository_refMethod · 0.80
writeFunction · 0.70
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected