Skip to content

Commit

Permalink
fix:improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cunla committed Feb 5, 2024
1 parent ffea720 commit 59686fb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {

testing {
dependencies {
implementation(libs.dotenv)
// implementation(libs.dotenv)
implementation(libs.mockito)
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ annotations = "24.1.0"
# plugins
kotlin = "1.9.21"
changelog = "2.2.0"
gradleIntelliJPlugin = "1.17.0"
gradleIntelliJPlugin = "1.17.1"
qodana = "0.1.13"
kover = "0.7.5"
dokka = "1.8.10"
Expand All @@ -14,7 +14,7 @@ serialization = "1.6.0"
[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" }
dotenv = { group = "io.github.cdimascio", name = "dotenv-kotlin", version = "6.4.1" }
#dotenv = { group = "io.github.cdimascio", name = "dotenv-kotlin", version = "6.4.1" }
mockito = { group = "org.mockito.kotlin", name = "mockito-kotlin", version = "5.2.1" }

[plugins]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,24 @@ import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.registerServiceInstance
import com.intellij.toolWindow.ToolWindowHeadlessManagerImpl.MockToolWindow
import com.intellij.util.concurrency.annotations.RequiresEdt
import io.github.cdimascio.dotenv.Dotenv
import io.github.cdimascio.dotenv.dotenv
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.yield
import org.jetbrains.plugins.github.api.GithubApiRequestExecutor
import org.jetbrains.plugins.github.api.GithubServerPath
import org.jetbrains.plugins.github.authentication.GHAccountsUtil
import org.jetbrains.plugins.github.authentication.accounts.GHAccountManager
import org.jetbrains.plugins.github.authentication.accounts.GithubAccount
import org.jetbrains.plugins.github.util.GHGitRepositoryMapping


abstract class GitHubActionsManagerBaseTest : BasePlatformTestCase() {

protected lateinit var myProject: Project
protected lateinit var factory: GhActionsToolWindowFactory
protected lateinit var toolWindow: ToolWindow

protected val host: GithubServerPath = GithubServerPath.from("github.com")
override fun setUp() {
super.setUp()
Dotenv.configure().load()
val dotenv = dotenv()
myProject = project
factory = GhActionsToolWindowFactory()
toolWindow = MockToolWindow(myProject)
toolWindow = MockToolWindow(project)
}

fun mockGhActionsService(repoUrls: Set<String>, accountNames: Collection<String>) {
Expand All @@ -54,18 +45,6 @@ abstract class GitHubActionsManagerBaseTest : BasePlatformTestCase() {
})
}

protected open fun setCurrentAccount(accountData: AccountData?) {
GHAccountsUtil.setDefaultAccount(myProject, accountData?.account)
}

protected data class AccountData(
val token: String,
val account: GithubAccount,
val username: String,
val executor: GithubApiRequestExecutor,
val repos: Set<String>,
)


companion object {
private const val RETRIES = 3
Expand Down

0 comments on commit 59686fb

Please sign in to comment.