feat: add more tests

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-05-20 20:55:54 +02:00
parent f04b0a2e54
commit f0b4c91c63
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
15 changed files with 19 additions and 2 deletions

View File

@ -98,7 +98,7 @@ async fn load_template_files(path: &Path) -> anyhow::Result<TemplateFiles> {
templates: read_dir(path) templates: read_dir(path)
.await? .await?
.into_iter() .into_iter()
.filter(|i| !i.ends_with(".jinja2")) .filter(|i| i.extension().and_then(|e| e.to_str()) == Some("jinja2"))
.collect(), .collect(),
raw: read_dir(&path.join("raw")).await.unwrap_or_default(), raw: read_dir(&path.join("raw")).await.unwrap_or_default(),
}) })
@ -149,7 +149,7 @@ async fn process_cluster(
} }
async fn process_template_file( async fn process_template_file(
cluster_name: &str, _cluster_name: &str,
template_file: &PathBuf, template_file: &PathBuf,
dest: &Path, dest: &Path,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {

View File

@ -0,0 +1,2 @@
cuddle/clusters:
dev:

View File

@ -0,0 +1,2 @@
cuddle/clusters:
dev:

View File

@ -10,3 +10,16 @@ async fn raw_files() -> anyhow::Result<()> {
Ok(()) Ok(())
} }
#[tokio::test]
async fn template_files() -> anyhow::Result<()> {
run_test("template_files").await?;
Ok(())
}
#[tokio::test]
async fn both() -> anyhow::Result<()> {
run_test("both").await?;
Ok(())
}