mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
test: batch 00 of refactoring CLI tests not to use PTY (#25868)
Part of https://github.com/coder/internal/issues/1400 Batch of refactored CLI tests to avoid creating PTYs.
This commit is contained in:
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"github.com/coder/coder/v2/cli/clitest"
|
||||
"github.com/coder/coder/v2/coderd/coderdtest"
|
||||
"github.com/coder/coder/v2/pty/ptytest"
|
||||
"github.com/coder/coder/v2/testutil"
|
||||
"github.com/coder/coder/v2/testutil/expecter"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -17,11 +17,12 @@ func TestMain(m *testing.M) {
|
||||
|
||||
func TestCli(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testutil.Context(t, testutil.WaitMedium)
|
||||
clitest.CreateTemplateVersionSource(t, nil)
|
||||
client := coderdtest.New(t, nil)
|
||||
i, config := clitest.New(t)
|
||||
clitest.SetupConfig(t, client, config)
|
||||
pty := ptytest.New(t).Attach(i)
|
||||
stdout := expecter.NewAttachedToInvocation(t, i)
|
||||
clitest.Start(t, i)
|
||||
pty.ExpectMatch("coder")
|
||||
stdout.ExpectMatchContext(ctx, "coder")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user