Skip to content

Commit

Permalink
test: secrets completion
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-athome committed Jan 23, 2025
1 parent 326ebdd commit 670fc50
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package it.casaricci.hass.plugin.completion

import com.intellij.codeInsight.completion.CompletionType
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixture4TestCase
import org.junit.Test

class SecretsCompletionTest : LightPlatformCodeInsightFixture4TestCase() {

override fun getTestDataPath(): String = "src/test/resources/completion/secrets"

@Test
fun testCompletion() {
myFixture.configureByFiles("configuration.yaml", "secrets.yaml")
myFixture.complete(CompletionType.BASIC)
val lookupElementStrings = myFixture.lookupElementStrings
assertNotNull(lookupElementStrings)
assertSameElements(lookupElementStrings!!, "latitude_home", "longitude_home")
}

}
2 changes: 2 additions & 0 deletions src/test/resources/completion/secrets/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
homeassistant:
latitude: !secret <caret>
2 changes: 2 additions & 0 deletions src/test/resources/completion/secrets/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
latitude_home: 90
longitude_home: 180

0 comments on commit 670fc50

Please sign in to comment.