Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge missing include_mail flag into config #1357

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lychee-bin/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ impl Config {
basic_auth: None;
skip_missing: false;
include_verbatim: false;
include_mail: false;
glob_ignore_case: false;
output: None;
require_https: false;
Expand Down
35 changes: 35 additions & 0 deletions lychee-bin/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,41 @@ mod cli {
Ok(())
}

#[tokio::test]
async fn test_include_mail_config() -> Result<()> {
let test_mail_address = "mailto:hello-test@testingabc.io";

let mut config = NamedTempFile::new()?;
writeln!(config, "include_mail = false")?;

let mut cmd = main_command();
cmd.arg("--config")
.arg(config.path().to_str().unwrap())
.arg("-")
.write_stdin(test_mail_address)
.env_clear()
.assert()
.success()
.stdout(contains("1 Total"))
.stdout(contains("1 Excluded"));

let mut config = NamedTempFile::new()?;
writeln!(config, "include_mail = true")?;

let mut cmd = main_command();
cmd.arg("--config")
.arg(config.path().to_str().unwrap())
.arg("-")
.write_stdin(test_mail_address)
.env_clear()
.assert()
.failure()
.stdout(contains("1 Total"))
.stdout(contains("1 Error"));

Ok(())
}

#[tokio::test]
async fn test_cache_config() -> Result<()> {
let mock_server = mock_server!(StatusCode::OK);
Expand Down
Loading