mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
tests(fixhandler): remove tests of an unexported sanitization method
Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
This commit is contained in:
@@ -266,67 +266,3 @@ func Test_fixPathToValidYamlExpression(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_sanitizeYaml(t *testing.T) {
|
||||
type args struct {
|
||||
fileAsString string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "sanitize yaml starting with ---",
|
||||
args: args{
|
||||
fileAsString: "---\nlabel: test",
|
||||
},
|
||||
want: "# ---\nlabel: test",
|
||||
},
|
||||
{
|
||||
name: "sanitize yaml not starting with ---",
|
||||
args: args{
|
||||
fileAsString: "label: test",
|
||||
},
|
||||
want: "label: test",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := sanitizeYaml(tt.args.fileAsString)
|
||||
assert.Equal(t, tt.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_revertSanitizeYaml(t *testing.T) {
|
||||
type args struct {
|
||||
fixedYamlString string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "revert sanitized yaml starting with ---",
|
||||
args: args{
|
||||
fixedYamlString: "# ---\nlabel: test",
|
||||
},
|
||||
want: "---\nlabel: test",
|
||||
},
|
||||
{
|
||||
name: "revert sanitized yaml not starting with ---",
|
||||
args: args{
|
||||
fixedYamlString: "label: test",
|
||||
},
|
||||
want: "label: test",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := revertSanitizeYaml(tt.args.fixedYamlString)
|
||||
assert.Equal(t, tt.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user