mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
Wrote new tests for the following packages in the cmd package:
- completion
- config
* In addition to tests, updated the code for the `stringKeysToSlice`
to return the final string slice in sorted order of keys.
Added new MockIKubescape struct in the core/mocks package
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
20 lines
653 B
Go
20 lines
653 B
Go
package completion
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// Generates autocompletion script for valid shell types
|
|
func TestGetCompletionCmd(t *testing.T) {
|
|
// Arrange
|
|
completionCmd := GetCompletionCmd()
|
|
assert.Equal(t, "completion [bash|zsh|fish|powershell]", completionCmd.Use)
|
|
assert.Equal(t, "Generate autocompletion script", completionCmd.Short)
|
|
assert.Equal(t, "To load completions", completionCmd.Long)
|
|
assert.Equal(t, completionCmdExamples, completionCmd.Example)
|
|
assert.Equal(t, true, completionCmd.DisableFlagsInUseLine)
|
|
assert.Equal(t, []string{"bash", "zsh", "fish", "powershell"}, completionCmd.ValidArgs)
|
|
}
|