package renderer
import (
"strings"
"testing"
"github.com/ungluedlabs/go-jdenticon/internal/engine"
)
// TestSVGRenderer_SecurityValidation tests defense-in-depth color validation
// This test addresses SEC-06 from the security report by verifying that
// the SVG renderer properly validates color inputs and prevents injection attacks.
func TestSVGRenderer_SecurityValidation(t *testing.T) {
tests := []struct {
name string
color string
expectInSVG bool
description string
}{
{
name: "valid_hex_color_3_digit",
color: "#f00",
expectInSVG: true,
description: "Valid 3-digit hex color should be rendered",
},
{
name: "valid_hex_color_6_digit",
color: "#ff0000",
expectInSVG: true,
description: "Valid 6-digit hex color should be rendered",
},
{
name: "valid_hex_color_8_digit",
color: "#ff0000ff",
expectInSVG: true,
description: "Valid 8-digit hex color with alpha should be rendered",
},
{
name: "injection_attempt_script",
color: "\">