Added tests package with helpers. Started on middleware tests.

This commit is contained in:
mikestefanello 2021-12-21 15:18:17 -05:00
parent 0e2625bf51
commit 58ba9f6dcc
9 changed files with 197 additions and 66 deletions

View file

@ -45,20 +45,16 @@ func (c *MailClient) SendTemplate(ctx echo.Context, to, template string, data in
ctx.Logger().Debugf("skipping template email sent to: %s")
}
// Parse the template, if needed
if err := c.templates.Parse(
// Parse and execute template
// Uncomment the first variable when ready to use
_, err := c.templates.ParseAndExecute(
"mail",
template,
template,
[]string{fmt.Sprintf("email/%s", template)},
[]string{},
); err != nil {
return err
}
// Execute the template
// Uncomment the first variable when ready to use
_, err := c.templates.Execute("mail", template, template, data)
data,
)
if err != nil {
return err
}