Skip to content

Commit

Permalink
test: retry 10 times in disconnection test
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Aug 21, 2024
1 parent 361de38 commit aacad99
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test/src/disconnect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ suite('Server disconnect', () => {
})

test('Should reconnect automatically when server is disconnected', async () => {
await vscode.commands.executeCommand('flix.simulateDisconnect')
for (let i = 0; i < 10; i++) {
await vscode.commands.executeCommand('flix.simulateDisconnect')

// Wait for the server to disconnect, otherwise the next command will hang
await sleep(1000)
// Wait for the server to disconnect, otherwise the next command will hang
await sleep(1000)

// Ensure that the server is reconnected
const docUri = getTestDocUri('src/Main.flix')
const position = new vscode.Position(9, 12)
const r = await vscode.commands.executeCommand<vscode.Hover[]>('vscode.executeHoverProvider', docUri, position)
const contents = r[0].contents[0] as vscode.MarkdownString
assert.strictEqual(contents.value.includes('Type'), true)
// Ensure that the server is reconnected
const docUri = getTestDocUri('src/Main.flix')
const position = new vscode.Position(9, 12)
const r = await vscode.commands.executeCommand<vscode.Hover[]>('vscode.executeHoverProvider', docUri, position)
const contents = r[0].contents[0] as vscode.MarkdownString
assert.strictEqual(contents.value.includes('Type'), true)
}
})
})

0 comments on commit aacad99

Please sign in to comment.