From 01b7faa5eba44140e445b6e19b6a6e568ccf9c3a Mon Sep 17 00:00:00 2001 From: Daniel M Date: Sat, 27 Apr 2024 12:54:46 -0400 Subject: [PATCH] fix:project startup test --- .../ghmanager/psi/ProjectStartupTest.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/test/kotlin/com/dsoftware/ghmanager/psi/ProjectStartupTest.kt b/src/test/kotlin/com/dsoftware/ghmanager/psi/ProjectStartupTest.kt index 199fafd..e850b67 100644 --- a/src/test/kotlin/com/dsoftware/ghmanager/psi/ProjectStartupTest.kt +++ b/src/test/kotlin/com/dsoftware/ghmanager/psi/ProjectStartupTest.kt @@ -1,10 +1,13 @@ package com.dsoftware.ghmanager.psi +import com.intellij.codeInsight.navigation.openFileWithPsiElement import com.intellij.openapi.components.service import com.intellij.openapi.extensions.ExtensionPointName +import com.intellij.psi.PsiManager import com.intellij.testFramework.common.initTestApplication import com.intellij.testFramework.junit5.RunInEdt import com.intellij.testFramework.rules.ClassLevelProjectModelExtension +import com.intellij.testFramework.useProject import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension @@ -26,8 +29,6 @@ class ProjectStartupTest { @Test fun testScanWorkflowFile() { - val startupActivity = - projectRule.project.extensionArea.getExtensionPoint(ExtensionPointName("com.intellij.postStartupActivity")) val content = """ jobs: build: @@ -39,12 +40,16 @@ class ProjectStartupTest { """.trimIndent() val workflowFile = projectRule.baseProjectDir - .newFile(".github/workflows/workflow1.yaml", content.toByteArray()) - + .newVirtualFile(".github/workflows/workflow1.yaml", content.toByteArray()) val project = projectRule.project - val gitHubActionDataService = project.service() - Assertions.assertEquals(1, gitHubActionDataService.actionsToResolve.size) + project.useProject { + val psiFile = PsiManager.getInstance(project).findFile(workflowFile) + openFileWithPsiElement(psiFile!!, true, true) + val gitHubActionDataService = project.service() + Assertions.assertEquals(1, gitHubActionDataService.actionsToResolve.size) + } + // projectResource.after() }