use crate::command::{
ChartPathOptions, ChartRef, SearchHub, SearchRepo, ShowAll, ShowChart, ShowCrds, ShowReadme,
ShowValues,
};
fn chart() -> ChartRef {
ChartRef::Repo("repo/web".to_owned())
}
#[test]
fn search_and_show_commands_build_what_the_literals_build() {
let chart_path = ChartPathOptions {
version: Some("1.2.3".to_owned()),
..ChartPathOptions::default()
};
assert_builds! {
"hub": SearchHub::builder().keyword("web").endpoint("https://hub.example").fail_on_no_result(true).build()
=> SearchHub {
keyword: Some("web".to_owned()),
endpoint: Some("https://hub.example".to_owned()),
fail_on_no_result: true,
};
"hub defaults": SearchHub::builder().build() => SearchHub::default();
"repo": SearchRepo::builder().keyword("web").devel(true).versions(true).version("^1").build()
=> SearchRepo {
keyword: Some("web".to_owned()),
devel: true,
versions: true,
version: Some("^1".to_owned()),
..SearchRepo::default()
};
"repo defaults": SearchRepo::builder().build() => SearchRepo::default();
"show chart": ShowChart::builder(chart()).chart_path(chart_path.clone()).devel(true).build()
=> ShowChart { chart_path: chart_path.clone(), devel: true, ..ShowChart::new(chart()) };
"show readme": ShowReadme::builder(chart()).devel(true).build()
=> ShowReadme { devel: true, ..ShowReadme::new(chart()) };
"show crds": ShowCrds::builder(chart()).devel(true).build()
=> ShowCrds { devel: true, ..ShowCrds::new(chart()) };
"show all": ShowAll::builder(chart()).chart_path(chart_path.clone()).build()
=> ShowAll { chart_path: chart_path.clone(), ..ShowAll::new(chart()) };
"show values": ShowValues::builder(chart()).jsonpath("{.a}").chart_path(chart_path.clone()).build()
=> ShowValues { jsonpath: Some("{.a}".to_owned()), chart_path, ..ShowValues::new(chart()) };
}
}