Skip to content

Commit

Permalink
fix(util-env): assert by check each element (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
whg517 committed Jul 11, 2024
1 parent e5f27c4 commit 881c381
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/util/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ func TestNewEnvVarsFromMap(t *testing.T) {
}

expectedEnvVars := []corev1.EnvVar{
{Name: "KEY1", Value: "VALUE1"},
{Name: "KEY2", Value: "VALUE2"},
{Name: "KEY1", Value: "VALUE1"},
}

envVars := NewEnvVarsFromMap(envs)

if len(envVars) != len(expectedEnvVars) {
t.Errorf("Expected %d env vars, but got %d", len(expectedEnvVars), len(envVars))
}
assert.Len(t, expectedEnvVars, len(envVars))

assert.Equal(t, expectedEnvVars, envVars)
assert.ElementsMatch(t, expectedEnvVars, envVars)
}

0 comments on commit 881c381

Please sign in to comment.