forked from jfrog/jfrog-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompletion_test.go
More file actions
48 lines (41 loc) · 1.64 KB
/
completion_test.go
File metadata and controls
48 lines (41 loc) · 1.64 KB
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 main
import (
"testing"
coreTests "github.com/jfrog/jfrog-cli-core/v2/utils/tests"
"github.com/jfrog/jfrog-cli/completion/shells/bash"
"github.com/jfrog/jfrog-cli/completion/shells/zsh"
"github.com/jfrog/jfrog-cli/utils/tests"
"github.com/stretchr/testify/assert"
)
func TestBashCompletionSetup(t *testing.T) {
jfrogCli := coreTests.NewJfrogCli(execMain, "jfrog", "")
content, _, err := tests.GetCmdOutput(t, jfrogCli, "completion", "bash")
assert.NoError(t, err)
assert.Equal(t, bash.BashAutocomplete, string(content))
}
func TestZshCompletionSetup(t *testing.T) {
jfrogCli := coreTests.NewJfrogCli(execMain, "jfrog", "")
content, _, err := tests.GetCmdOutput(t, jfrogCli, "completion", "zsh")
assert.NoError(t, err)
assert.Equal(t, zsh.ZshAutocomplete, string(content))
}
func TestFishCompletionSetup(t *testing.T) {
jfrogCli := coreTests.NewJfrogCli(execMain, "jfrog", "")
content, _, err := tests.GetCmdOutput(t, jfrogCli, "completion", "fish")
assert.NoError(t, err)
assert.Contains(t, string(content), "complete -c")
}
func TestBashCompletionRt(t *testing.T) {
jfrogCli := coreTests.NewJfrogCli(execMain, "jfrog", "")
content, errContent, err := tests.GetCmdOutput(t, jfrogCli, "rt", "--generate-bash-completion")
assert.NoError(t, err)
assert.Contains(t, string(content), "permission-target-create")
assert.Empty(t, string(errContent))
}
func TestBashCompletionJf(t *testing.T) {
jfrogCli := coreTests.NewJfrogCli(execMain, "jfrog", "")
content, errContent, err := tests.GetCmdOutput(t, jfrogCli, "", "--generate-bash-completion")
assert.NoError(t, err)
assert.Contains(t, string(content), "rt")
assert.Empty(t, string(errContent))
}