MCPcopy Create free account
hub / github.com/docker/docker-language-server / TestDefinition_Configs

Function TestDefinition_Configs

internal/compose/definition_test.go:95–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93}
94
95func TestDefinition_Configs(t *testing.T) {
96 composeFileURI := fmt.Sprintf("file:///%v", strings.TrimPrefix(filepath.ToSlash(filepath.Join(os.TempDir(), "compose.yaml")), "/"))
97 u := uri.URI(composeFileURI)
98 for _, tc := range configReferenceTestCases {
99 doc := document.NewComposeDocument(document.NewDocumentManager(), u, 1, []byte(tc.content))
100 params := protocol.DefinitionParams{
101 TextDocumentPositionParams: protocol.TextDocumentPositionParams{
102 TextDocument: protocol.TextDocumentIdentifier{URI: composeFileURI},
103 Position: protocol.Position{Line: tc.line, Character: tc.character},
104 },
105 }
106
107 t.Run(fmt.Sprintf("%v (Location)", tc.name), func(t *testing.T) {
108 locations, err := Definition(context.Background(), false, doc, &params)
109 require.NoError(t, err)
110 require.Equal(t, tc.locations(composeFileURI), locations)
111 })
112
113 t.Run(fmt.Sprintf("%v (LocationLink)", tc.name), func(t *testing.T) {
114 links, err := Definition(context.Background(), true, doc, &params)
115 require.NoError(t, err)
116 require.Equal(t, tc.links(composeFileURI), links)
117 })
118 }
119}
120
121func TestDefinition_Secrets(t *testing.T) {
122 composeFileURI := fmt.Sprintf("file:///%v", strings.TrimPrefix(filepath.ToSlash(filepath.Join(os.TempDir(), "compose.yaml")), "/"))

Callers

nothing calls this directly

Calls 4

NewComposeDocumentFunction · 0.92
NewDocumentManagerFunction · 0.92
DefinitionFunction · 0.70
URIMethod · 0.65

Tested by

no test coverage detected