Skip to content

Commit f3ccfda

Browse files
committed
refactor: reuse completions check logic
1 parent 577ef43 commit f3ccfda

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

completions/src/test/kotlin/lsp/LspClientTest.kt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,12 @@ class LspClientTest : CompletionTest {
3232
fun `LSP client should provide completions for libs declared in build file (kotlinx-coroutines)`() = runBlocking {
3333
val snippet =
3434
"""
35+
import kotlinx.coroutines.runBlocking
3536
fun main() {
3637
runBlock$CARET_MARKER
3738
}
3839
""".trimIndent()
39-
checkCompletions(snippet, listOf("runBlocking"))
40-
}
41-
42-
private fun checkCompletions(snippet: String, expectedLabels: List<String>) = runBlocking {
43-
val (code, position) = extractCaret { snippet }
44-
val uri = randomResourceUri
45-
client.openDocument(uri, code)
46-
val completions = client.getCompletion(uri, position).await()
47-
assertAll(
48-
{ assertTrue { completions.isNotEmpty() } },
49-
{ assertTrue(completions.map { it.label }.containsAll(expectedLabels)) },
50-
)
40+
performCompletionChecks(snippet, listOf("runBlocking"))
5141
}
5242

5343
@AfterEach

0 commit comments

Comments
 (0)