Skip to content

Commit

Permalink
try to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qvalentin committed Jul 21, 2024
1 parent efc8a68 commit 46b6031
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions internal/adapter/yamlls/yamlls_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package yamlls

import (
"os"
"testing"

lsplocal "github.com/mrjosh/helm-ls/internal/lsp"
Expand All @@ -17,13 +18,20 @@ func TestIsRelevantFile(t *testing.T) {
}

connector.documents = &lsplocal.DocumentStore{}
yamlFile := uri.File("../../../testdata/example/templates/deployment.yaml")
nonYamlFile := uri.File("../../../testdata/example/templates/_helpers.tpl")
connector.documents.Store(yamlFile, util.DefaultConfig)
connector.documents.Store(nonYamlFile, util.DefaultConfig)
yamlFile := "../../../testdata/example/templates/deployment.yaml"
nonYamlFile := "../../../testdata/example/templates/_helpers.tpl"

assert.True(t, connector.isRelevantFile(yamlFile))
assert.False(t, connector.isRelevantFile(nonYamlFile))
yamlFileContent, err := os.ReadFile(yamlFile)
assert.NoError(t, err)

nonYamlFileContent, err := os.ReadFile(nonYamlFile)
assert.NoError(t, err)

connector.documents.Store(yamlFile, yamlFileContent, util.DefaultConfig)
connector.documents.Store(nonYamlFile, nonYamlFileContent, util.DefaultConfig)

assert.True(t, connector.isRelevantFile(uri.File(yamlFile)))
assert.False(t, connector.isRelevantFile(uri.File(nonYamlFile)))
}

func TestShouldRun(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/document_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *DocumentStore) DidOpen(params *lsp.DidOpenTextDocumentParams, helmlsCon
func (s *DocumentStore) Store(filename string, content []byte, helmlsConfig util.HelmlsConfiguration) {
ast := ParseAst(nil, string(content))
fileUri := uri.File(filename)

Check failure on line 55 in internal/lsp/document_store.go

View workflow job for this annotation

GitHub Actions / lint (1.21.5, ubuntu-latest)

var-naming: var fileUri should be fileURI (revive)
s.documents.Store(filename,
s.documents.Store(fileUri,
&Document{
URI: fileUri,
Path: filename,
Expand Down

0 comments on commit 46b6031

Please sign in to comment.