Files
coder/cli/clitest/clitest_test.go
Bryan 6009c90d1d refactor: Rename 'expect' package to 'console' (#297)
Fixes #291 - renames the `expect` go package to `console`, and changes the api from `expect.NewTestConsole` to `console.New`, and a few other small changes to support the linter (ie, `ConsoleOpts` -> `Opts`)
2022-02-15 16:47:33 -08:00

32 lines
631 B
Go

package clitest_test
import (
"testing"
"github.com/stretchr/testify/require"
"go.uber.org/goleak"
"github.com/coder/coder/cli/clitest"
"github.com/coder/coder/coderd/coderdtest"
"github.com/coder/coder/console"
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
func TestCli(t *testing.T) {
t.Parallel()
clitest.CreateProjectVersionSource(t, nil)
client := coderdtest.New(t)
cmd, config := clitest.New(t)
clitest.SetupConfig(t, client, config)
cons := console.New(t, cmd)
go func() {
err := cmd.Execute()
require.NoError(t, err)
}()
_, err := cons.ExpectString("coder")
require.NoError(t, err)
}