Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khareyash05 committed Apr 21, 2023
1 parent ddf56d1 commit 7a465c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions pkg/plugin/util/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package util

import (
"bytes"
"strings"
"os/exec"
"testing"
"strings"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
Expand All @@ -29,10 +30,12 @@ var _ = ginkgo.Describe("RunCmd", func() {
})

ginkgo.It("executes the command and redirects output to stdout", func() {
err = RunCmd("echo test", "echo", "")
cmd := exec.Command("echo", "test")
cmd.Stdout = output
err = cmd.Run()
gomega.Expect(err).ToNot(gomega.HaveOccurred())

gomega.Expect(strings.TrimSpace(output.String())).To(gomega.Equal("test"))

})

ginkgo.It("returns an error if the command fails", func() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/util/testdata/exampleFile.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
exampleTargetexampleCodeexampleCodeexampleCode
exampleTargetexampleCodeexampleCodeexampleCodeexampleCode

0 comments on commit 7a465c0

Please sign in to comment.