github.com/microsoft/fabrikate@v1.0.0-alpha.1.0.20210115014322-dc09194d0885/internal/generators/helm_test.go (about)

     1  package generators
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestCleanK8sManifest(t *testing.T) {
    11  	manifest := `
    12  ---
    13  this should be removed
    14  ---
    15  this: is a valid map and should stay
    16  another:
    17    entry: in the map
    18  ---
    19  this should be removed as well
    20  ---
    21  # This should be removed
    22  ---
    23  ---
    24  this is another: valid map
    25  should: not be removed
    26  ---
    27  # Another to be removed
    28  `
    29  	cleaned, err := cleanK8sManifest(manifest)
    30  	assert.Nil(t, err)
    31  	entries := strings.Split(cleaned, "\n---")
    32  	assert.Equal(t, 2, len(entries))
    33  }