Skip to content

Commit

Permalink
test: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Duologic committed Jul 1, 2024
1 parent b52b7e3 commit b3ee312
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pkg/server/completion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,46 @@ func TestCompletion(t *testing.T) {
},
},
},
{
name: "local assigned",
filename: "testdata/local_reassign.jsonnet",
replaceString: "a: newjob",
replaceByString: "a: job.",
expected: protocol.CompletionList{
IsIncomplete: false,
Items: []protocol.CompletionItem{
{
Label: "steps",
Kind: protocol.FieldCompletion,
Detail: "job.steps",
InsertText: "steps",
LabelDetails: protocol.CompletionItemLabelDetails{
Description: "object",
},
},
},
},
},
{
name: "local reassigned",
filename: "testdata/local_reassign.jsonnet",
replaceString: "a: newjob",
replaceByString: "a: newjob.",
expected: protocol.CompletionList{
IsIncomplete: false,
Items: []protocol.CompletionItem{
{
Label: "steps",
Kind: protocol.FieldCompletion,
Detail: "newjob.steps",
InsertText: "steps",
LabelDetails: protocol.CompletionItemLabelDetails{
Description: "object",
},
},
},
},
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
Expand Down
9 changes: 9 additions & 0 deletions pkg/server/testdata/local_reassign.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
local job = {
steps: { name: 'a', value: 'b' },
};

local newjob = job;

{
a: newjob,
}

0 comments on commit b3ee312

Please sign in to comment.