Skip to content

Commit

Permalink
add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Nov 27, 2024
1 parent b8319b0 commit 6aa76fc
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lychee-bin/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1880,4 +1880,28 @@ mod cli {

Ok(())
}

#[tokio::test]
async fn test_retry() -> Result<()> {
let mock_server = wiremock::MockServer::start().await;

wiremock::Mock::given(wiremock::matchers::method("GET"))
.respond_with(ResponseTemplate::new(429))
.up_to_n_times(1)
.mount(&mock_server)
.await;

wiremock::Mock::given(wiremock::matchers::method("GET"))
.respond_with(ResponseTemplate::new(200))
.mount(&mock_server)
.await;

let mut cmd = main_command();
cmd.arg("-")
.write_stdin(mock_server.uri())
.assert()
.success();

Ok(())
}
}

0 comments on commit 6aa76fc

Please sign in to comment.