fix: boost coverage

This commit is contained in:
Tristan Cartledge
2023-12-03 20:55:30 +00:00
parent 369540a825
commit d56bc91272

View File

@@ -1561,6 +1561,8 @@ func TestGenerateHashString(t *testing.T) {
assert.Equal(t, "", assert.Equal(t, "",
GenerateHashString(nil)) GenerateHashString(nil))
assert.Equal(t, "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2", GenerateHashString(utils.CreateStringNode("test")))
} }
func TestGenerateHashString_Pointer(t *testing.T) { func TestGenerateHashString_Pointer(t *testing.T) {
@@ -2106,3 +2108,42 @@ func TestHashExtensions(t *testing.T) {
}) })
} }
} }
func TestValueToString(t *testing.T) {
type args struct {
v any
}
tests := []struct {
name string
args args
want string
}{
{
name: "string",
args: args{
v: "hello",
},
want: "hello",
},
{
name: "int",
args: args{
v: 1,
},
want: "1",
},
{
name: "yaml.Node",
args: args{
v: utils.CreateStringNode("world"),
},
want: "world",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := ValueToString(tt.args.v)
assert.Equal(t, tt.want, strings.TrimSpace(got))
})
}
}