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

View File

@ -5,7 +5,7 @@ import (
"github.com/coder/coder/cli/clitest"
"github.com/coder/coder/coderd/coderdtest"
"github.com/coder/coder/expect"
"github.com/coder/coder/console"
"github.com/coder/coder/provisioner/echo"
"github.com/coder/coder/provisionersdk/proto"
"github.com/stretchr/testify/require"
@ -36,7 +36,7 @@ func TestWorkspaceCreate(t *testing.T) {
cmd, root := clitest.New(t, "workspaces", "create", project.Name)
clitest.SetupConfig(t, client, root)
console := expect.NewTestConsole(t, cmd)
cons := console.New(t, cmd)
closeChan := make(chan struct{})
go func() {
err := cmd.Execute()
@ -51,12 +51,12 @@ func TestWorkspaceCreate(t *testing.T) {
for i := 0; i < len(matches); i += 2 {
match := matches[i]
value := matches[i+1]
_, err := console.ExpectString(match)
_, err := cons.ExpectString(match)
require.NoError(t, err)
_, err = console.SendLine(value)
_, err = cons.SendLine(value)
require.NoError(t, err)
}
_, err := console.ExpectString("Create")
_, err := cons.ExpectString("Create")
require.NoError(t, err)
<-closeChan
})