mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
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:
@ -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
|
||||
})
|
||||
|
Reference in New Issue
Block a user