Skip to content

Commit

Permalink
[Test] coverage code by tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanGalek committed Dec 17, 2024
1 parent a15efb3 commit d3de77f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
4 changes: 0 additions & 4 deletions templateProvider.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package diago

import (
"errors"
"html/template"
"strings"
)
Expand All @@ -25,9 +24,6 @@ func (p DefaultTemplateProvider) GetTemplate() string {
func (d *DefaultPanelGenerator) GenerateHTML(name string, templateProvider TemplateProvider, data interface{}) (string, error) {
templateContent := templateProvider.GetTemplate()
tp := template.New(name)
if tp == nil {
return "", errors.New("Bad template name")
}
tpl, err := tp.Parse(templateContent)
if err != nil {
return "", err
Expand Down
5 changes: 0 additions & 5 deletions tests/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"html/template"
"log"
_ "log"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -66,10 +65,6 @@ func TestGenerateHTML_ParseError(t *testing.T) {

result, err := d.GenerateHTML("diagoPanel", mockTemplateProvider, nil)

log.Printf("Result: %s", result)

log.Printf("Err: %t", err != nil)
log.Printf("Err: %v", err)
assert.Empty(t, result)
assert.Error(t, err)
assert.Contains(t, err.Error(), "unclosed action")
Expand Down

0 comments on commit d3de77f

Please sign in to comment.