From 08b2b69273ebc93252b2e05ab498e94cc3cb86b6 Mon Sep 17 00:00:00 2001 From: qvalentin Date: Mon, 8 Jul 2024 08:49:28 +0200 Subject: [PATCH] test(yamlls): test shouldRun --- internal/adapter/yamlls/yamlls_test.go | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 internal/adapter/yamlls/yamlls_test.go diff --git a/internal/adapter/yamlls/yamlls_test.go b/internal/adapter/yamlls/yamlls_test.go new file mode 100644 index 0000000..feaa82c --- /dev/null +++ b/internal/adapter/yamlls/yamlls_test.go @@ -0,0 +1,31 @@ +package yamlls + +import ( + "testing" + + "github.com/mrjosh/helm-ls/internal/util" + "github.com/stretchr/testify/assert" + "go.lsp.dev/uri" +) + +func TestIsRelevantFile(t *testing.T) { + connector := Connector{ + config: util.YamllsConfiguration{ + Enabled: true, + EnabledForFileExtensions: []string{".yaml", ".yml"}, + }, + } + assert.True(t, connector.isRelevantFile(uri.File("test.yaml"))) + assert.False(t, connector.isRelevantFile(uri.File("_helpers.tpl"))) +} + +func TestShouldRun(t *testing.T) { + connector := Connector{ + config: util.YamllsConfiguration{ + Enabled: true, + EnabledForFileExtensions: []string{".yaml", ".yml"}, + }, + } + assert.False(t, connector.shouldRun(uri.File("test.yaml"))) + assert.False(t, connector.shouldRun(uri.File("_helpers.tpl"))) +}