From 8b807f627620d4079d72d812c4f3a82846daf534 Mon Sep 17 00:00:00 2001 From: Daniel M Date: Tue, 6 Feb 2024 15:14:06 -0600 Subject: [PATCH] fix:improve tests --- .../ghmanager/TestWindowTabController.kt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.kt b/src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.kt index e8041d5d..41021d90 100644 --- a/src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.kt +++ b/src/test/kotlin/com/dsoftware/ghmanager/TestWindowTabController.kt @@ -7,6 +7,7 @@ import com.dsoftware.ghmanager.api.model.WorkflowTypes import com.dsoftware.ghmanager.data.WorkflowDataContextService import com.dsoftware.ghmanager.data.WorkflowRunSelectionContext import com.intellij.openapi.components.service +import com.intellij.ui.OnePixelSplitter import io.mockk.MockKMatcherScope import io.mockk.every import io.mockk.mockk @@ -49,15 +50,24 @@ class TestWindowTabController : GitHubActionsManagerBaseTest() { val content = toolWindow.contentManager.contents[0] TestCase.assertEquals("owner/repo", content.displayName) TestCase.assertTrue(content.component is JPanel) - val panel = content.component as JPanel - TestCase.assertEquals(1, panel.componentCount) + val tabWrapPanel = content.component as JPanel + TestCase.assertEquals(1, tabWrapPanel.componentCount) TestCase.assertEquals(1, workflowDataContextService.repositories.size) val workflowRunSelectionContext: WorkflowRunSelectionContext = workflowDataContextService.repositories.values.first().value.get() TestCase.assertEquals(0, workflowRunSelectionContext.runsListModel.size) - verify { - executorMock.execute(any(), ofType(GithubApiRequest::class)) + verify(atLeast = 1) { + executorMock.execute(any(), matchApiRequestUrl("/actions/workflows")) + executorMock.execute( + any(), + matchApiRequestUrl>("/collaborators") + ) + executorMock.execute(any(), matchApiRequestUrl>("/branches")) + executorMock.execute(any(), matchApiRequestUrl("/actions/workflows")) } + TestCase.assertEquals(1, (tabWrapPanel.components[0] as JPanel).componentCount) + val splitterComponent = (tabWrapPanel.components[0] as JPanel).components[0] + TestCase.assertTrue(splitterComponent is OnePixelSplitter) } private fun mockGithubApiRequestExecutor(