test(templater): Add a test for the default template function
This commit is contained in:
parent
ab059ad41c
commit
df1a9a1625
2 changed files with 18 additions and 0 deletions
|
|
@ -162,3 +162,20 @@ func TestFailOnMissingKeys(t *testing.T) {
|
|||
t.Errorf("Templating failed with unexpected error: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultTemplateFunction(t *testing.T) {
|
||||
ctx := context.Context{}
|
||||
resourceSet := context.ResourceSet{}
|
||||
|
||||
res, err := templateFile(&ctx, &resourceSet, "testdata/test-default.txt")
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Templating with default values should have succeeded.\n")
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if res.Rendered != "defaultValue\n" {
|
||||
t.Error("Result does not contain expected rendered default value.")
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue