Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amolero-nr committed Oct 24, 2023
1 parent e47eda9 commit 12913b6
Showing 1 changed file with 73 additions and 3 deletions.
76 changes: 73 additions & 3 deletions internal/entities/command_deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestParseAttributesSingleKeyValue(t *testing.T) {
"key:value",
}

var want = map[string]string{
var want = map[string]interface{}{
"key": "value",
}
var errWant error
Expand All @@ -39,13 +39,83 @@ func TestParseAttributesSingleKeyValue(t *testing.T) {
assert.Equal(t, want, *got)
}

func TestParseAttributesSingleIntegerKeyValue(t *testing.T) {
a := []string{
"a:1",
}

var want = map[string]interface{}{
"a": "1",
}
var errWant error

got, errGot := parseCustomAttributes(&a)

assert.Equal(t, errWant, errGot)
assert.Equal(t, want, *got)
}

func TestParseAttributesSingleFloatingKeyValue(t *testing.T) {
a := []string{
"a:1.5",
}

var want = map[string]interface{}{
"a": "1.5",
}
var errWant error

got, errGot := parseCustomAttributes(&a)

assert.Equal(t, errWant, errGot)
assert.Equal(t, want, *got)
}

func TestParseAttributesSingleBooleanKeyValue(t *testing.T) {
a := []string{
"a:true",
}

var want = map[string]interface{}{
"a": "true",
}
var errWant error

got, errGot := parseCustomAttributes(&a)

assert.Equal(t, errWant, errGot)
assert.Equal(t, want, *got)
}

func TestParseAttributesMultipleTypesKeyValues(t *testing.T) {
a := []string{
"a:true",
"b:1",
"c:1.5",
`d:"value"`,
}

var want = map[string]interface{}{
"a": "true",
"b": "1",
"c": "1.5",
"d": `"value"`,
}
var errWant error

got, errGot := parseCustomAttributes(&a)

assert.Equal(t, errWant, errGot)
assert.Equal(t, want, *got)
}

func TestParseAttributesTwoKeyValues(t *testing.T) {
a := []string{
"key:value",
"key2:value2",
}

var want = map[string]string{
var want = map[string]interface{}{
"key": "value",
"key2": "value2",
}
Expand Down Expand Up @@ -97,6 +167,6 @@ func TestParseAttributesEmptyStringSlice(t *testing.T) {
assert.Equal(t, want, got)
}

func nilPointerMapStringString() *map[string]string {
func nilPointerMapStringString() *map[string]interface{} {
return nil
}

0 comments on commit 12913b6

Please sign in to comment.