Skip to content

Commit

Permalink
test(yamlls): integration test for document-symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
qvalentin committed Jul 28, 2024
1 parent bd71c30 commit 2bb5d00
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions internal/adapter/yamlls/symbol_integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//go:build integration

package yamlls

import (
"context"
"testing"
"time"

"github.com/mrjosh/helm-ls/internal/util"
"github.com/stretchr/testify/assert"
lsp "go.lsp.dev/protocol"
"go.lsp.dev/uri"
)

func TestYamllsDocumentSymoblIntegration(t *testing.T) {
config := util.DefaultConfig.YamllsConfiguration

testCases := []struct {
file string
expectedLen int
}{
{
file: "../../../testdata/example/templates/deployment.yaml",
expectedLen: 4,
},
}
for _, tt1 := range testCases {
tt := tt1
t.Run(tt.file, func(t *testing.T) {
t.Parallel()
yamllsConnector, documents, _ := getYamlLsConnector(t, config)
openFile(t, documents, tt.file, yamllsConnector)

assert.Eventually(t, func() bool {
result, err := yamllsConnector.CallDocumentSymbol(context.Background(), &lsp.DocumentSymbolParams{
TextDocument: lsp.TextDocumentIdentifier{
URI: uri.File(tt.file),
},
})
return err == nil && len(result) == tt.expectedLen
}, time.Second*10, time.Second*2)
})
}
}

0 comments on commit 2bb5d00

Please sign in to comment.