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 6, 2024
1 parent ba0aca8 commit 49c4b1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.registerServiceInstance
import com.intellij.toolWindow.ToolWindowHeadlessManagerImpl
import com.intellij.util.concurrency.annotations.RequiresEdt
import io.mockk.Matcher
import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.flow.MutableStateFlow
Expand Down
18 changes: 12 additions & 6 deletions src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,23 @@ class TestWindowTabController : GitHubActionsManagerBaseTest() {
})
val workflowTypesResponse = WorkflowTypes(workflowTypes.size, workflowTypes.toList())
executorMock.apply {
every {
execute(any(), any<GithubApiRequest<WorkflowRuns>>())
every {// workflow runs
execute(any(), match<GithubApiRequest<WorkflowRuns>> { it.url.contains("/actions/runs") })
} returns WorkflowRuns(workflowRunsList.size, workflowRunsList.toList())
every {// collaborators
execute(any(), any<GithubApiRequest<GithubResponsePage<GithubUserWithPermissions>>>())
execute(
any(),
match<GithubApiRequest<GithubResponsePage<GithubUserWithPermissions>>> { it.url.contains("/collaborators") }
)
} returns collaboratorsResponse
every { // branches
execute(any(), any<GithubApiRequest<GithubResponsePage<GithubBranch>>>())
execute(
any(),
match<GithubApiRequest<GithubResponsePage<GithubBranch>>> { it.url.contains("/branches") }
)
} returns branchesResponse
every { // branches
execute(any(), any<GithubApiRequest<WorkflowTypes>>())
every { // workflow types
execute(any(), match<GithubApiRequest<WorkflowTypes>> { it.url.contains("/actions/workflows") })
} returns workflowTypesResponse
}

Expand Down

0 comments on commit 49c4b1b

Please sign in to comment.