mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +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>
22 lines
520 B
Go
22 lines
520 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/kubescape/kubescape/v3/core/mocks"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestGetDeleteCmd(t *testing.T) {
|
|
// Create a mock Kubescape interface
|
|
mockKubescape := &mocks.MockIKubescape{}
|
|
|
|
// Call the GetConfigCmd function
|
|
configCmd := getDeleteCmd(mockKubescape)
|
|
|
|
// Verify the command name and short description
|
|
assert.Equal(t, "delete", configCmd.Use)
|
|
assert.Equal(t, "Delete cached configurations", configCmd.Short)
|
|
assert.Equal(t, "", configCmd.Long)
|
|
}
|