Skip to content

Commit 29cb428

Browse files
committed
Use assert.ElementsMatch for testing available commands
1 parent cd18588 commit 29cb428

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cmd/step/main_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,23 @@ import (
55
"regexp"
66
"testing"
77

8+
"github.com/stretchr/testify/assert"
89
"github.com/stretchr/testify/require"
910
)
1011

1112
func TestAppHasAllCommands(t *testing.T) {
1213
app := newApp(&bytes.Buffer{}, &bytes.Buffer{})
1314
require.NotNil(t, app)
1415

15-
require.Equal(t, "step", app.Name)
16-
require.Equal(t, "step", app.HelpName)
16+
assert.Equal(t, "step", app.Name)
17+
assert.Equal(t, "step", app.HelpName)
1718

1819
var names = make([]string, 0, len(app.Commands))
1920
for _, c := range app.Commands {
2021
names = append(names, c.Name)
2122
}
22-
require.Equal(t, []string{
23+
24+
assert.ElementsMatch(t, []string{
2325
"help", "api", "path", "base64", "fileserver",
2426
"certificate", "completion", "context", "crl",
2527
"crypto", "oauth", "version", "ca", "beta", "ssh",
@@ -42,5 +44,5 @@ func TestAppRuns(t *testing.T) {
4244
require.Empty(t, stderr.Bytes())
4345

4446
output := ansiRegex.ReplaceAllString(stdout.String(), "")
45-
require.Contains(t, output, "step -- plumbing for distributed systems")
47+
assert.Contains(t, output, "step -- plumbing for distributed systems")
4648
}

0 commit comments

Comments
 (0)