From 3737bad66795a515ba224a25a035f270c23e1330 Mon Sep 17 00:00:00 2001 From: Teodora Sandu Date: Thu, 28 Mar 2024 16:13:27 +0000 Subject: [PATCH] test: try to fix tests --- .../SuggestionDescriptionPanelFromLSTest.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/test/kotlin/io/snyk/plugin/ui/toolwindow/SuggestionDescriptionPanelFromLSTest.kt b/src/test/kotlin/io/snyk/plugin/ui/toolwindow/SuggestionDescriptionPanelFromLSTest.kt index 2f8b03b9b..d41e2b75b 100644 --- a/src/test/kotlin/io/snyk/plugin/ui/toolwindow/SuggestionDescriptionPanelFromLSTest.kt +++ b/src/test/kotlin/io/snyk/plugin/ui/toolwindow/SuggestionDescriptionPanelFromLSTest.kt @@ -6,8 +6,10 @@ import com.intellij.openapi.util.registry.Registry import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.PsiFile import com.intellij.testFramework.fixtures.BasePlatformTestCase +import com.intellij.ui.jcef.JBCefApp import io.mockk.every import io.mockk.mockk +import io.mockk.mockkStatic import io.mockk.unmockkAll import io.snyk.plugin.Severity import io.snyk.plugin.pluginSettings @@ -96,11 +98,12 @@ class SuggestionDescriptionPanelFromLSTest : BasePlatformTestCase() { fun `test createUI should show nothing if feature flag is enabled but JCEF is not`() { pluginSettings().isGlobalIgnoresFeatureEnabled = true + mockkStatic(JBCefApp::class) + every { JBCefApp.isSupported() } returns false + every { issue.additionalData.details } returns "HTML message" cut = SuggestionDescriptionPanelFromLS(snykCodeFile, issue) - Registry.get("ide.browser.jcef.enabled").setValue("false") - val actual = getJLabelByText(cut, "Test message") assertNull(actual) @@ -112,11 +115,12 @@ class SuggestionDescriptionPanelFromLSTest : BasePlatformTestCase() { fun `test createUI should build panel with HTML from details if feature flag is enabled`() { pluginSettings().isGlobalIgnoresFeatureEnabled = true + mockkStatic(JBCefApp::class) + every { JBCefApp.isSupported() } returns true + every { issue.additionalData.details } returns "HTML message" cut = SuggestionDescriptionPanelFromLS(snykCodeFile, issue) - Registry.get("ide.browser.jcef.enabled").setValue("true") - val actual = getJLabelByText(cut, "Test message") assertNull(actual)