Skip to content

Commit a1c6c50

Browse files
committed
Add one more tests for fetch_artifacts
This tests checks that the fetcher works also for nested projects
1 parent 01d242c commit a1c6c50

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

src/crufty.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,44 @@ mod tests {
9595

9696
temp.close().unwrap();
9797
}
98+
99+
#[test]
100+
fn test_where_scanned_folder_has_three_rust_projects() {
101+
// given
102+
let temp = TempDir::new().unwrap();
103+
let project1 = mk_subpath(&temp, "project1");
104+
mk_rust_project(&project1);
105+
let project2 = mk_subpath(&temp, "project2");
106+
mk_rust_project(&project2);
107+
let project3 = mk_subpath(&temp, "work/project3");
108+
mk_rust_project(&project3);
109+
110+
// when
111+
let mut results = fetch_artifacts(&temp.to_path_buf());
112+
113+
// then
114+
assert_eq!(results.len(), 3, "Expected exactly three artifacts");
115+
results.sort();
116+
117+
let expected_path_1 =
118+
temp.child("project1").child("target").path().to_path_buf();
119+
let expected_1 = ArtifactCandidate::new(expected_path_1);
120+
assert_eq!(&results[0], &expected_1);
121+
122+
let expected_path_2 =
123+
temp.child("project2").child("target").path().to_path_buf();
124+
let expected_2 = ArtifactCandidate::new(expected_path_2);
125+
assert_eq!(&results[1], &expected_2);
126+
127+
let expected_path_3 = temp
128+
.child("work")
129+
.child("project3")
130+
.child("target")
131+
.path()
132+
.to_path_buf();
133+
let expected_3 = ArtifactCandidate::new(expected_path_3);
134+
assert_eq!(&results[2], &expected_3);
135+
136+
temp.close().unwrap();
137+
}
98138
}

0 commit comments

Comments
 (0)