-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(intellij): start adding some ci tests for the intellij plugin
- Loading branch information
1 parent
ab3348d
commit dd7dfcb
Showing
6 changed files
with
85 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...tive/src/test/kotlin/tech/contextive/contextive/ContextiveLspServerSupportProviderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package tech.contextive.contextive | ||
|
||
import com.intellij.openapi.project.BaseProjectDirectories | ||
import com.intellij.openapi.project.BaseProjectDirectories.Companion.getBaseDirectories | ||
import org.junit.jupiter.api.Assertions.* | ||
import org.junit.jupiter.api.Test | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.vfs.VirtualFile | ||
import com.intellij.platform.lsp.api.LspServerSupportProvider | ||
import io.mockk.* | ||
|
||
|
||
class ContextiveLspServerSupportProviderTest { | ||
|
||
@Test | ||
fun ShouldAlwaysStartLanguageServer() { | ||
val lspServerSupportProvider = ContextiveLspServerSupportProvider() | ||
|
||
val project = mockk<Project> { | ||
every { getService<BaseProjectDirectories>(any()) } returns | ||
mockk { | ||
every { getBaseDirectories() } returns emptySet() | ||
} | ||
} | ||
val file = mockk<VirtualFile>() | ||
val serverStarter = mockk<LspServerSupportProvider.LspServerStarter> { | ||
every { ensureServerStarted(any()) } returns Unit | ||
} | ||
|
||
lspServerSupportProvider.fileOpened(project, file, serverStarter); | ||
|
||
verify { serverStarter.ensureServerStarted(any()) } | ||
|
||
confirmVerified(serverStarter) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...j/contextive/src/test/kotlin/tech/contextive/contextive/LanguageServerDownloaderKtTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package tech.contextive.contextive | ||
|
||
import org.junit.jupiter.api.AfterEach | ||
import org.junit.jupiter.api.Assertions.* | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.CsvSource | ||
|
||
class LanguageServerDownloaderKtTest { | ||
|
||
@BeforeEach | ||
fun setUp() { | ||
} | ||
|
||
@AfterEach | ||
fun tearDown() { | ||
} | ||
|
||
@ParameterizedTest | ||
@CsvSource("Windows,win", "MacOs X,osx", "Ubuntu,linux") | ||
fun shouldGetOsCode(osName: String, expectedOsCode: String) { | ||
val existingOsName = System.getProperty("os.name") | ||
System.setProperty("os.name", osName) | ||
|
||
val osCode = getOsCode() | ||
|
||
assertEquals(expectedOsCode, osCode) | ||
|
||
System.setProperty("os.name", existingOsName) | ||
} | ||
} |