Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d2cbf36

Browse files
committed
Add CLI test
1 parent b5a774a commit d2cbf36

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

cli/clitest/clitest_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package clitest_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/coder/coder/cli/clitest"
7+
"github.com/coder/coder/coderd/coderdtest"
8+
"github.com/stretchr/testify/require"
9+
"go.uber.org/goleak"
10+
)
11+
12+
func TestMain(m *testing.M) {
13+
goleak.VerifyTestMain(m)
14+
}
15+
16+
func TestCli(t *testing.T) {
17+
t.Parallel()
18+
clitest.CreateProjectVersionSource(t, nil)
19+
client := coderdtest.New(t)
20+
cmd, config := clitest.New(t)
21+
clitest.SetupConfig(t, client, config)
22+
console := clitest.NewConsole(t, cmd)
23+
go func() {
24+
err := cmd.Execute()
25+
require.NoError(t, err)
26+
}()
27+
_, err := console.ExpectString("coder")
28+
require.NoError(t, err)
29+
}

0 commit comments

Comments
 (0)