summaryrefslogtreecommitdiff
path: root/internal/cli/workers/command_test.go
blob: b9b3c6245fc9d6cf0659da0887fa594bc99f102c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package workers_test

import (
	"testing"

	"github.com/roadrunner-server/roadrunner/v2024/internal/cli/workers"

	"github.com/stretchr/testify/assert"
)

func TestCommandProperties(t *testing.T) {
	cmd := workers.NewCommand(nil, nil)

	assert.Equal(t, "workers", cmd.Use)
	assert.NotNil(t, cmd.RunE)
}

func TestCommandFlags(t *testing.T) {
	cmd := workers.NewCommand(nil, nil)

	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")
}