Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit a3b8554

Browse files
fix: add config changes to setup/teardown and a wait before running the assistant checks
1 parent d3df336 commit a3b8554

3 files changed

Lines changed: 25 additions & 13 deletions

File tree

src/test/suite/assistant-completion.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,24 @@ suite("assistant-completion.ts test", () => {
8989
.expects("useRecipeCallback")
9090
.withArgs(42069)
9191
.once();
92+
93+
await updateConfig({} as vscode.Uri, {
94+
"codiga.editor.shortcutCompletion": true,
95+
"codiga.editor.inlineCompletion": true,
96+
});
97+
await wait(2000);
9298
});
9399

94100
// this is executed after each test finishes
95101
teardown(async () => {
96102
// things get messy really quick, do not remove this step
97103
// await updateConfig(rustUri, originalConfig);
98104
sandbox.restore();
105+
106+
await updateConfig({} as vscode.Uri, {
107+
"codiga.editor.shortcutCompletion": false,
108+
"codiga.editor.inlineCompletion": false,
109+
});
99110
});
100111

101112
test("test insert suggestion from completion widget works", async () => {

src/test/suite/variable-transformation.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
autoComplete,
1414
recipeWithTransformVariables,
1515
testDataUri,
16+
updateConfig,
1617
} from "../testUtils";
1718

1819
// test there's no recipe variable in the final recipe insertion, we create mocks and stub
@@ -27,7 +28,7 @@ suite("variable transformation test", () => {
2728
let usedRecipeMock: sinon.SinonExpectation;
2829

2930
// this is executed before each test
30-
setup(() => {
31+
setup(async () => {
3132
// define the stub and mock
3233
getRecipeStub = sandbox
3334
.stub(getRecipesApiCall, "getRecipesForClientByShorcut")
@@ -38,12 +39,23 @@ suite("variable transformation test", () => {
3839
.expects("useRecipeCallback")
3940
.withArgs(42069)
4041
.once();
42+
43+
await updateConfig({} as vscode.Uri, {
44+
"codiga.editor.shortcutCompletion": true,
45+
"codiga.editor.inlineCompletion": true,
46+
});
47+
await wait(2000);
4148
});
4249

4350
// this is executed after each test finishes
44-
teardown(() => {
51+
teardown(async () => {
4552
// things get messy really quick, do not remove this step
4653
sandbox.restore();
54+
55+
await updateConfig({} as vscode.Uri, {
56+
"codiga.editor.shortcutCompletion": false,
57+
"codiga.editor.inlineCompletion": false,
58+
});
4759
});
4860

4961
test("detect transformation variables are not present", async () => {

src/test/testUtils.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,6 @@ export async function insertText(editor: vscode.TextEditor, code: string) {
231231
}
232232

233233
export async function autoComplete() {
234-
const configuration = vscode.workspace.getConfiguration("codiga");
235-
await configuration.update(
236-
"editor.inlineCompletion",
237-
true,
238-
vscode.ConfigurationTarget.Global
239-
);
240-
await configuration.update(
241-
"editor.shortcutCompletion",
242-
true,
243-
vscode.ConfigurationTarget.Global
244-
);
245234
await vscode.commands.executeCommand("editor.action.triggerSuggest");
246235
await wait(500);
247236
await vscode.commands.executeCommand("acceptSelectedSuggestion");

0 commit comments

Comments
 (0)