Skip to content

Commit ab04782

Browse files
committed
Make tests more reliable
1 parent 0977c68 commit ab04782

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/test/suite/file_actions.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ suite('File Actions', () => {
212212
const emptyDirPath = vscode.workspace.asRelativePath(emptyDirUri, false);
213213

214214
// === Act ===
215-
216-
fileActions.handleGetFiles({ id: 'abc', name: 'get_files' });
217-
// NEURO.client!.sendContext('test');
215+
fileActions.handleGetFiles({ id: 'abc', name: 'get_files' });
218216

219217
// Wait for context to be sent
220218
await checkNoErrorWithTimeout(() => { verify(mockedClient.sendContext(anything())).once(); });
@@ -232,6 +230,8 @@ suite('File Actions', () => {
232230
});
233231

234232
test('handleOpenFile', async function() {
233+
// Increase test timeout to make sure it has enough time to finish instead of the default 2s
234+
this.timeout(10000);
235235
// === Arrange ===
236236
const fileContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n68043cf7-01af-43cb-a9ac-6feeec7cdcc1\n';
237237
const fileUri = await createTestFile('file.js', fileContent);
@@ -252,9 +252,9 @@ suite('File Actions', () => {
252252
// === Act ===
253253
fileActions.handleOpenFile({ id: 'abc', name: 'open_file', params: { filePath: filePath } });
254254
// Allow VS Code to open and show the document before asserting
255-
await checkNoErrorWithTimeout(() => { verify(mockedClient.sendContext(anything())).once(); });
255+
await checkNoErrorWithTimeout(() => { verify(mockedClient.sendContext(anything())).once(); }, 5000, 100);
256256
// Brief delay to ensure activeTextEditor is updated across platforms
257-
await new Promise(resolve => setTimeout(resolve, 100));
257+
await new Promise(resolve => setTimeout(resolve, 200));
258258
const [context] = capture(mockedClient.sendContext).last();
259259

260260
// === Assert ===

0 commit comments

Comments
 (0)