Skip to content

Commit

Permalink
use an empty file instead of one that needs formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jpogran committed Apr 11, 2024
1 parent 33b5092 commit 872dd94
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
20 changes: 17 additions & 3 deletions src/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,27 @@ export async function testCompletion(
position: vscode.Position,
expectedCompletionList: vscode.CompletionList,
) {
const actualCompletionList = (await vscode.commands.executeCommand(
const actualCompletionList = await vscode.commands.executeCommand<vscode.CompletionList>(
'vscode.executeCompletionItemProvider',
docUri,
position,
)) as vscode.CompletionList;
);

console.log('---actualCompletionList---');

actualCompletionList.items.forEach((item) => {
console.log(item.label);
});
console.log('---');

console.log('---expectedCompletionList---');

expectedCompletionList.items.forEach((item) => {
console.log(item.label);
});

assert.equal(actualCompletionList.items.length, expectedCompletionList.items.length);
console.log(`actual: ${actualCompletionList.items.length} expected: ${expectedCompletionList.items.length}`);
assert.deepStrictEqual(actualCompletionList.items.length, expectedCompletionList.items.length);
expectedCompletionList.items.forEach((expectedItem, i) => {
const actualItem = actualCompletionList.items[i];
assert.deepStrictEqual(actualItem.label, expectedItem.label);
Expand Down
4 changes: 2 additions & 2 deletions src/test/integration/completion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const snippets = [
];

suite('Language Server Completion', function suite() {
const docUri = getDocUri('actions.tf');
const docUri = getDocUri('empty.tf');

this.beforeAll(async () => {
await open(docUri);
Expand Down Expand Up @@ -48,7 +48,7 @@ suite('Language Server Completion', function suite() {
new vscode.CompletionItem('terraform', vscode.CompletionItemKind.Class),
new vscode.CompletionItem('variable', vscode.CompletionItemKind.Class),
];
// expected.push(...snippets);
expected.push(...snippets);
await testCompletion(docUri, new vscode.Position(0, 0), {
items: expected,
});
Expand Down
Empty file added test/fixtures/empty.tf
Empty file.
3 changes: 3 additions & 0 deletions test/fixtures/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ module "compute" {

instance_name = "terraform-machine"



}

0 comments on commit 872dd94

Please sign in to comment.