Skip to content

Commit

Permalink
Merge pull request #253 from kartouch/785-unit-test-commands
Browse files Browse the repository at this point in the history
openebs#785 add command unit test
  • Loading branch information
kmova committed Feb 1, 2018
2 parents a9138a9 + 45c039c commit 36e4856
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cmd/maya-apiserver/app/command/commands_test.go
@@ -0,0 +1,27 @@
package command

import (
"testing"
)

func TestNewCommand(t *testing.T) {
cases := []struct {
use string
}{
{"start"}, {"version"},
}

cmd := NewCommand()
cmds := cmd.Commands()

if len(cmds) != len(cases) {
t.Errorf("ExpectedCommands: %d ActualCommands: '%d'", len(cases), len(cmds))
}

for i, c := range cases {
if c.use != cmds[i].Use {
t.Errorf("ExpectedCommand: '%s' ActualCommand: '%s'", c.use, cmds[i].Use)
}
}

}

0 comments on commit 36e4856

Please sign in to comment.