mirror of https://github.com/open-feature/cli.git
29 lines
543 B
Go
29 lines
543 B
Go
package cmd
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/open-feature/cli/internal/config"
|
|
"github.com/open-feature/cli/internal/filesystem"
|
|
"github.com/spf13/afero"
|
|
)
|
|
|
|
func TestInitCmd(t *testing.T) {
|
|
fs := afero.NewMemMapFs()
|
|
filesystem.SetFileSystem(fs)
|
|
outputFile := "flags-test.json"
|
|
cmd := GetInitCmd()
|
|
// global flag exists on root only.
|
|
config.AddRootFlags(cmd)
|
|
|
|
cmd.SetArgs([]string{
|
|
"-m",
|
|
outputFile,
|
|
})
|
|
err := cmd.Execute()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
compareOutput(t, "testdata/success_init.golden", outputFile, fs)
|
|
}
|