All checks were successful
release-tag / release-image (push) Successful in 2m0s
20 lines
386 B
Go
20 lines
386 B
Go
package badge
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
func TestRenderEscapesText(t *testing.T) {
|
|
data, etag := Render(Options{Label: `<script>`, Message: `A&B`, Extent: "assisted"})
|
|
if bytes.Contains(data, []byte(`<script>`)) {
|
|
t.Fatal("unescaped label")
|
|
}
|
|
if !bytes.Contains(data, []byte(`A&B`)) {
|
|
t.Fatal("message not escaped")
|
|
}
|
|
if etag == "" {
|
|
t.Fatal("missing etag")
|
|
}
|
|
}
|