diff options
author | Valery Piashchynski <[email protected]> | 2022-01-15 16:24:55 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2022-01-15 16:24:55 +0300 |
commit | 21863fecdd18d9862a96521588c6ddd6cad0e49c (patch) | |
tree | d1c6b0031abd77e77fa9c71358d973b82dee88fc /internal/cli/workers/command_test.go | |
parent | 13609dd03dd0d2fa85b9fb850be787bf4e2ea67f (diff) | |
parent | f50f3e217f53d2793323fd48af9d8cbe8f5ed7a6 (diff) |
Merge pull request from roadrunner-server/repository-move
[#894]: feat(move): repository content update
Diffstat (limited to 'internal/cli/workers/command_test.go')
-rw-r--r-- | internal/cli/workers/command_test.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/internal/cli/workers/command_test.go b/internal/cli/workers/command_test.go new file mode 100644 index 00000000..d0c92e63 --- /dev/null +++ b/internal/cli/workers/command_test.go @@ -0,0 +1,49 @@ +package workers_test + +import ( + "testing" + + "github.com/roadrunner-server/roadrunner/v2/internal/cli/workers" + + "github.com/roadrunner-server/config/v2" + "github.com/stretchr/testify/assert" +) + +func TestCommandProperties(t *testing.T) { + cmd := workers.NewCommand(&config.Plugin{}) + + assert.Equal(t, "workers", cmd.Use) + assert.NotNil(t, cmd.RunE) +} + +func TestCommandFlags(t *testing.T) { + cmd := workers.NewCommand(&config.Plugin{}) + + cases := []struct { + giveName string + wantShorthand string + wantDefault string + }{ + {giveName: "interactive", wantShorthand: "i", wantDefault: "false"}, + } + + for _, tt := range cases { + tt := tt + t.Run(tt.giveName, func(t *testing.T) { + flag := cmd.Flag(tt.giveName) + + if flag == nil { + assert.Failf(t, "flag not found", "flag [%s] was not found", tt.giveName) + + return + } + + assert.Equal(t, tt.wantShorthand, flag.Shorthand) + assert.Equal(t, tt.wantDefault, flag.DefValue) + }) + } +} + +func TestExecution(t *testing.T) { + t.Skip("Command execution is not implemented yet") +} |