Skip to content

Commit

Permalink
test: try to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
teodora-sandu committed Mar 28, 2024
1 parent 28f220b commit 3737bad
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>HTML message</html>"
cut = SuggestionDescriptionPanelFromLS(snykCodeFile, issue)

Registry.get("ide.browser.jcef.enabled").setValue("false")

val actual = getJLabelByText(cut, "<html>Test message</html>")
assertNull(actual)

Expand All @@ -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>HTML message</html>"
cut = SuggestionDescriptionPanelFromLS(snykCodeFile, issue)

Registry.get("ide.browser.jcef.enabled").setValue("true")

val actual = getJLabelByText(cut, "<html>Test message</html>")
assertNull(actual)

Expand Down

0 comments on commit 3737bad

Please sign in to comment.