package webapp import ( "testing" "github.com/stretchr/testify/require" ) func Test_replaceBaseHrefPlaceholder(t *testing.T) { var ( tcc = []struct { name string app string base string body string }{ {"unquoted condensed", "test-app", "", `... ... `}, {"unquoted spacy", "test-app", "", `... ... `}, {"quoted spacy", "test-app", "", `... `}, {"preset", "test-app", "", `... ... `}, {"unquoted condensed", "test-app", "base", `... ... `}, {"unquoted spacy", "test-app", "base", `... ... `}, {"quoted spacy", "test-app", "base", `... `}, {"preset", "test-app", "base", `... ... `}, } ) for _, tc := range tcc { t.Run(tc.name, func(t *testing.T) { var ( req = require.New(t) fixed = string(replaceBaseHrefPlaceholder([]byte(tc.body), tc.app, tc.base)) ) req.NotContains(fixed, "Error!") req.Contains(fixed, "