From 49c4b1b647ed37a1b56eacb92c97770083287da6 Mon Sep 17 00:00:00 2001 From: Daniel M Date: Tue, 6 Feb 2024 14:49:11 -0600 Subject: [PATCH] fix:improve tests --- .../ghmanager/GitHubActionsManagerBaseTest.kt | 1 + .../ghmanager/TestWindowTabController.kt | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/test/kotlin/com/dsoftware/ghmanager/GitHubActionsManagerBaseTest.kt b/src/test/kotlin/com/dsoftware/ghmanager/GitHubActionsManagerBaseTest.kt index fa5baa21..d3ad0177 100644 --- a/src/test/kotlin/com/dsoftware/ghmanager/GitHubActionsManagerBaseTest.kt +++ b/src/test/kotlin/com/dsoftware/ghmanager/GitHubActionsManagerBaseTest.kt @@ -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 diff --git a/src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.kt b/src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.kt index 3fa942f1..a7a58967 100644 --- a/src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.kt +++ b/src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.kt @@ -79,17 +79,23 @@ class TestWindowTabController : GitHubActionsManagerBaseTest() { }) val workflowTypesResponse = WorkflowTypes(workflowTypes.size, workflowTypes.toList()) executorMock.apply { - every { - execute(any(), any>()) + every {// workflow runs + execute(any(), match> { it.url.contains("/actions/runs") }) } returns WorkflowRuns(workflowRunsList.size, workflowRunsList.toList()) every {// collaborators - execute(any(), any>>()) + execute( + any(), + match>> { it.url.contains("/collaborators") } + ) } returns collaboratorsResponse every { // branches - execute(any(), any>>()) + execute( + any(), + match>> { it.url.contains("/branches") } + ) } returns branchesResponse - every { // branches - execute(any(), any>()) + every { // workflow types + execute(any(), match> { it.url.contains("/actions/workflows") }) } returns workflowTypesResponse }