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`)
This commit is contained in:
Bryan
2022-02-15 16:47:33 -08:00
committed by GitHub
parent 35291d358a
commit 6009c90d1d
16 changed files with 71 additions and 70 deletions
+6 -5
View File
@@ -3,11 +3,12 @@ package clitest_test
import (
"testing"
"github.com/coder/coder/cli/clitest"
"github.com/coder/coder/coderd/coderdtest"
"github.com/coder/coder/expect"
"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) {
@@ -20,11 +21,11 @@ func TestCli(t *testing.T) {
client := coderdtest.New(t)
cmd, config := clitest.New(t)
clitest.SetupConfig(t, client, config)
console := expect.NewTestConsole(t, cmd)
cons := console.New(t, cmd)
go func() {
err := cmd.Execute()
require.NoError(t, err)
}()
_, err := console.ExpectString("coder")
_, err := cons.ExpectString("coder")
require.NoError(t, err)
}