Skip to content

Commit

Permalink
Update template_test.go
Browse files Browse the repository at this point in the history
Added test for ToInt template function
  • Loading branch information
derBiggi authored Jan 16, 2017
1 parent 0e88d44 commit ff53eb7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions services/template/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,18 @@ func TestTemplateToLowerFunction(t *testing.T) {
})
})
}

func TestTemplateToIntFunction(t *testing.T) {
Convey("#RenderTemplate", t, func() {
templateName := "templateName"
domains := []string{"example.com", "example.net"}
params := map[string]interface{}{"idx": "1", "domains": domains}

templateContent := "{{index .domains (ToInt .idx)}}"
Convey("should transform an indexo to integer", func() {
content, _ := RenderTemplate(templateName, templateContent, params)
So(content, ShouldEqual, "example.net")
})
})
}

0 comments on commit ff53eb7

Please sign in to comment.