Skip to content

Commit

Permalink
update mock and functional tests
Browse files Browse the repository at this point in the history
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
  • Loading branch information
anandrkskd committed Nov 3, 2022
1 parent e408b63 commit b18cafc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
7 changes: 4 additions & 3 deletions pkg/init/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions pkg/kclient/mock_Client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions tests/integration/interactive_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,36 @@ var _ = Describe("odo init interactive command tests", func() {
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml"))
})

It("should print automation command with proper values", func() {
command := []string{"odo", "init"}
starter := "go-starter"
componentName := "my-go-app"
devfileName := "go"

output, err := helper.RunInteractive(command, nil, func(ctx helper.InteractiveContext) {

helper.ExpectString(ctx, "Select language")
helper.SendLine(ctx, "Go")

helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")

helper.ExpectString(ctx, "Which starter project do you want to use")
helper.SendLine(ctx, starter)

helper.ExpectString(ctx, "Enter component name")
helper.SendLine(ctx, componentName)

helper.ExpectString(ctx, "Your new component 'my-go-app' is ready in the current directory")

})

Expect(err).To(BeNil())
Expect(output).To(ContainSubstring("odo init --name %s --devfile %s --devfile-registry DefaultDevfileRegistry --starter %s", componentName, devfileName, starter))
Expect(output).To(ContainSubstring("Your new component 'my-go-app' is ready in the current directory"))
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml"))
})

It("should download correct devfile", func() {

command := []string{"odo", "init"}
Expand Down

0 comments on commit b18cafc

Please sign in to comment.