@@ -148,9 +148,9 @@ suite('InteractiveChatController', function () {
148
148
149
149
test ( 'run (show/hide)' , async function ( ) {
150
150
ctrl = instaService . createInstance ( TestController , editor ) ;
151
+ const p = ctrl . waitFor ( TestController . INIT_SEQUENCE_AUTO_SEND ) ;
151
152
const run = ctrl . run ( { message : 'Hello' , autoSend : true } ) ;
152
-
153
- await ctrl . waitFor ( TestController . INIT_SEQUENCE_AUTO_SEND ) ;
153
+ await p ;
154
154
assert . ok ( ctrl . getWidgetPosition ( ) !== undefined ) ;
155
155
ctrl . cancelSession ( ) ;
156
156
@@ -218,9 +218,10 @@ suite('InteractiveChatController', function () {
218
218
219
219
test ( 'typing outside of wholeRange finishes session' , async function ( ) {
220
220
ctrl = instaService . createInstance ( TestController , editor ) ;
221
+ const p = ctrl . waitFor ( TestController . INIT_SEQUENCE_AUTO_SEND ) ;
221
222
ctrl . run ( { message : 'Hello' , autoSend : true } ) ;
222
223
223
- await ctrl . waitFor ( TestController . INIT_SEQUENCE_AUTO_SEND ) ;
224
+ await p ;
224
225
225
226
const session = inlineChatSessionService . getSession ( editor , editor . getModel ( ) ! . uri ) ;
226
227
assert . ok ( session ) ;
@@ -257,9 +258,10 @@ suite('InteractiveChatController', function () {
257
258
} ) ;
258
259
store . add ( d ) ;
259
260
ctrl = instaService . createInstance ( TestController , editor ) ;
261
+ const p = ctrl . waitFor ( TestController . INIT_SEQUENCE ) ;
260
262
ctrl . run ( { message : 'Hello' , autoSend : false } ) ;
261
263
262
- await ctrl . waitFor ( TestController . INIT_SEQUENCE ) ;
264
+ await p ;
263
265
264
266
const session = inlineChatSessionService . getSession ( editor , editor . getModel ( ) ! . uri ) ;
265
267
assert . ok ( session ) ;
@@ -298,12 +300,13 @@ suite('InteractiveChatController', function () {
298
300
} ) ;
299
301
store . add ( d ) ;
300
302
ctrl = instaService . createInstance ( TestController , editor ) ;
301
- const p = ctrl . run ( { message : 'Hello' , autoSend : true } ) ;
303
+ const p = ctrl . waitFor ( [ ...TestController . INIT_SEQUENCE , State . MAKE_REQUEST ] ) ;
304
+ const r = ctrl . run ( { message : 'Hello' , autoSend : true } ) ;
302
305
303
- await ctrl . waitFor ( [ ... TestController . INIT_SEQUENCE , State . MAKE_REQUEST ] ) ;
306
+ await p ;
304
307
ctrl . acceptSession ( ) ;
305
308
306
- await p ;
309
+ await r ;
307
310
assert . strictEqual ( ctrl . getWidgetPosition ( ) , undefined ) ;
308
311
} ) ;
309
312
} ) ;
0 commit comments