Skip to content

Commit 0e1f8b1

Browse files
committed
fix tests, waitFor needs to be called before entering run because that now pushes/enters a state sync
1 parent b97e7b8 commit 0e1f8b1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/vs/workbench/contrib/inlineChat/test/browser/inlineChatController.test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ suite('InteractiveChatController', function () {
148148

149149
test('run (show/hide)', async function () {
150150
ctrl = instaService.createInstance(TestController, editor);
151+
const p = ctrl.waitFor(TestController.INIT_SEQUENCE_AUTO_SEND);
151152
const run = ctrl.run({ message: 'Hello', autoSend: true });
152-
153-
await ctrl.waitFor(TestController.INIT_SEQUENCE_AUTO_SEND);
153+
await p;
154154
assert.ok(ctrl.getWidgetPosition() !== undefined);
155155
ctrl.cancelSession();
156156

@@ -218,9 +218,10 @@ suite('InteractiveChatController', function () {
218218

219219
test('typing outside of wholeRange finishes session', async function () {
220220
ctrl = instaService.createInstance(TestController, editor);
221+
const p = ctrl.waitFor(TestController.INIT_SEQUENCE_AUTO_SEND);
221222
ctrl.run({ message: 'Hello', autoSend: true });
222223

223-
await ctrl.waitFor(TestController.INIT_SEQUENCE_AUTO_SEND);
224+
await p;
224225

225226
const session = inlineChatSessionService.getSession(editor, editor.getModel()!.uri);
226227
assert.ok(session);
@@ -257,9 +258,10 @@ suite('InteractiveChatController', function () {
257258
});
258259
store.add(d);
259260
ctrl = instaService.createInstance(TestController, editor);
261+
const p = ctrl.waitFor(TestController.INIT_SEQUENCE);
260262
ctrl.run({ message: 'Hello', autoSend: false });
261263

262-
await ctrl.waitFor(TestController.INIT_SEQUENCE);
264+
await p;
263265

264266
const session = inlineChatSessionService.getSession(editor, editor.getModel()!.uri);
265267
assert.ok(session);
@@ -298,12 +300,13 @@ suite('InteractiveChatController', function () {
298300
});
299301
store.add(d);
300302
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 });
302305

303-
await ctrl.waitFor([...TestController.INIT_SEQUENCE, State.MAKE_REQUEST]);
306+
await p;
304307
ctrl.acceptSession();
305308

306-
await p;
309+
await r;
307310
assert.strictEqual(ctrl.getWidgetPosition(), undefined);
308311
});
309312
});

0 commit comments

Comments
 (0)