Skip to content

Commit d448ab4

Browse files
tomaswoj-ethsmoelius
authored andcommitted
refactor: simplify markdown_link_check integration test by removing npm existence check and streamlining path construction
1 parent 0070d65 commit d448ab4

File tree

1 file changed

+3
-20
lines changed
  • test-fuzz/tests/integration

1 file changed

+3
-20
lines changed

test-fuzz/tests/integration/ci.rs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -184,35 +184,18 @@ fn remove_avatars(value: &mut serde_json::Value) {
184184

185185
#[test]
186186
fn markdown_link_check() {
187-
// Check if npm is installed before proceeding
188-
if Command::new("which").arg("npm").output().is_err() {
189-
println!("Skipping markdown link check: npm not found.");
190-
return;
191-
}
192-
193-
let tempdir = tempdir().expect("Failed to create temporary directory");
187+
let tempdir = tempdir().unwrap();
194188

195-
// Install markdown-link-check locally in the temp directory
196189
Command::new("npm")
197190
.args(["install", "markdown-link-check"])
198191
.current_dir(&tempdir)
199192
.logged_assert()
200193
.success();
201194

202-
// Construct the path to README.md relative to the crate root
203-
let readme_md = Path::new(env!("CARGO_MANIFEST_DIR"))
204-
.parent()
205-
.unwrap()
206-
.join("README.md");
195+
let readme_md = Path::new(env!("CARGO_MANIFEST_DIR")).join("../README.md");
207196

208-
// Run markdown-link-check using npx from the temp directory
209197
Command::new("npx")
210-
.args([
211-
"markdown-link-check",
212-
"-q",
213-
"-v",
214-
&readme_md.to_string_lossy(),
215-
])
198+
.args(["markdown-link-check", readme_md.to_str().unwrap()])
216199
.current_dir(&tempdir)
217200
.logged_assert()
218201
.success();

0 commit comments

Comments
 (0)