7
7
"github.com/coder/coder/cli/clitest"
8
8
"github.com/coder/coder/coderd"
9
9
"github.com/coder/coder/coderd/coderdtest"
10
- "github.com/coder/coder/expect "
10
+ "github.com/coder/coder/console "
11
11
"github.com/stretchr/testify/require"
12
12
)
13
13
@@ -28,7 +28,7 @@ func TestLogin(t *testing.T) {
28
28
// accurately detect Windows ptys when they are not attached to a process:
29
29
// https://github.com/mattn/go-isatty/issues/59
30
30
root , _ := clitest .New (t , "login" , client .URL .String (), "--force-tty" )
31
- console := expect . NewTestConsole (t , root )
31
+ cons := console . New (t , root )
32
32
go func () {
33
33
err := root .Execute ()
34
34
require .NoError (t , err )
@@ -44,12 +44,12 @@ func TestLogin(t *testing.T) {
44
44
for i := 0 ; i < len (matches ); i += 2 {
45
45
match := matches [i ]
46
46
value := matches [i + 1 ]
47
- _ , err := console .ExpectString (match )
47
+ _ , err := cons .ExpectString (match )
48
48
require .NoError (t , err )
49
- _ , err = console .SendLine (value )
49
+ _ , err = cons .SendLine (value )
50
50
require .NoError (t , err )
51
51
}
52
- _ , err := console .ExpectString ("Welcome to Coder" )
52
+ _ , err := cons .ExpectString ("Welcome to Coder" )
53
53
require .NoError (t , err )
54
54
})
55
55
@@ -70,17 +70,17 @@ func TestLogin(t *testing.T) {
70
70
require .NoError (t , err )
71
71
72
72
root , _ := clitest .New (t , "login" , client .URL .String (), "--force-tty" )
73
- console := expect . NewTestConsole (t , root )
73
+ cons := console . New (t , root )
74
74
go func () {
75
75
err := root .Execute ()
76
76
require .NoError (t , err )
77
77
}()
78
78
79
- _ , err = console .ExpectString ("Paste your token here:" )
79
+ _ , err = cons .ExpectString ("Paste your token here:" )
80
80
require .NoError (t , err )
81
- _ , err = console .SendLine (token .SessionToken )
81
+ _ , err = cons .SendLine (token .SessionToken )
82
82
require .NoError (t , err )
83
- _ , err = console .ExpectString ("Welcome to Coder" )
83
+ _ , err = cons .ExpectString ("Welcome to Coder" )
84
84
require .NoError (t , err )
85
85
})
86
86
@@ -96,17 +96,17 @@ func TestLogin(t *testing.T) {
96
96
require .NoError (t , err )
97
97
98
98
root , _ := clitest .New (t , "login" , client .URL .String (), "--force-tty" )
99
- console := expect . NewTestConsole (t , root )
99
+ cons := console . New (t , root )
100
100
go func () {
101
101
err := root .Execute ()
102
102
require .Error (t , err )
103
103
}()
104
104
105
- _ , err = console .ExpectString ("Paste your token here:" )
105
+ _ , err = cons .ExpectString ("Paste your token here:" )
106
106
require .NoError (t , err )
107
- _ , err = console .SendLine ("an-invalid-token" )
107
+ _ , err = cons .SendLine ("an-invalid-token" )
108
108
require .NoError (t , err )
109
- _ , err = console .ExpectString ("That's not a valid token!" )
109
+ _ , err = cons .ExpectString ("That's not a valid token!" )
110
110
require .NoError (t , err )
111
111
})
112
112
}
0 commit comments