feat(refacto): move everything in internal package
This allows to install katenary with `go install` and to clean up the project folder.
This commit is contained in:
33
internal/generator/extrafiles/readme_test.go
Normal file
33
internal/generator/extrafiles/readme_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package extrafiles
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReadMeFile_Basic(t *testing.T) {
|
||||
values := map[string]any{
|
||||
"replicas": 2,
|
||||
"image": map[string]any{
|
||||
"repository": "nginx",
|
||||
"tag": "latest",
|
||||
},
|
||||
}
|
||||
|
||||
result := ReadMeFile("testchart", "A test chart", values)
|
||||
t.Logf("Generated README content:\n%s", result)
|
||||
paramerRegExp := regexp.MustCompile(`\|\s+` + "`" + `(.*?)` + "`" + `\s+\|\s+` + "`" + `(.*?)` + "`" + `\s+\|`)
|
||||
matches := paramerRegExp.FindAllStringSubmatch(result, -1)
|
||||
if len(matches) != 3 {
|
||||
t.Errorf("Expected 5 lines in the table for headers and parameters, got %d", len(matches))
|
||||
}
|
||||
if matches[0][1] != "image.repository" || matches[0][2] != "nginx" {
|
||||
t.Errorf("Expected third line to be image.repository, got %s", matches[1])
|
||||
}
|
||||
if matches[1][1] != "image.tag" || matches[1][2] != "latest" {
|
||||
t.Errorf("Expected fourth line to be image.tag, got %s", matches[2])
|
||||
}
|
||||
if matches[2][1] != "replicas" || matches[2][2] != "2" {
|
||||
t.Errorf("Expected second line to be replicas, got %s", matches[0])
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user