package test
import (
"html/template"
"strconv"
"time"
"github.com/brianvoe/gofakeit/v6"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2"
)
func GetFiberTestConfig() fiber.Config {
engine := html.New("./../../templates", ".html")
// nolint:gocritic
engine.AddFunc("now", func() time.Time {
return time.Now()
})
// nolint:gosec
engine.AddFunc("noescape", func(str string) template.HTML {
return template.HTML(str)
})
engine.AddFunc("gridsep", func(i, l int) bool {
i++
return i%3 == 0 && i != l
})
engine.AddFunc("version", func() string {
return strconv.Itoa(gofakeit.Number(1, 1000))
})
return fiber.Config{
Views: engine,
}
}