Skip to content

Commit 3ab5a4a

Browse files
committed
chore(vscode): add an integration test for gtd
1 parent 5285753 commit 3ab5a4a

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

vscode/extension/tests/go_to_definition.spec.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('Go to definition for macro', async () => {
1111
try {
1212
const { window, close } = await startVSCode(tempDir);
1313

14-
// Wait for the models folder to be visible
14+
// Wait for the models folder to be visible
1515
await window.waitForSelector('text=models');
1616

1717
// Click on the models folder, excluding external_models
@@ -35,4 +35,34 @@ test('Go to definition for macro', async () => {
3535
} finally {
3636
await fs.removeSync(tempDir);
3737
}
38-
});
38+
});
39+
40+
test("Go to definition for model", async () => {
41+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'));
42+
await fs.copy(SUSHI_SOURCE_PATH, tempDir);
43+
44+
try {
45+
const { window, close } = await startVSCode(tempDir);
46+
47+
// Wait for the models folder to be visible
48+
await window.waitForSelector('text=models');
49+
50+
// Click on the models folder, excluding external_models
51+
await window.getByRole('treeitem', { name: 'models', exact: true }).locator('a').click();
52+
53+
// Open the customer_revenue_lifetime model
54+
await window.getByRole('treeitem', { name: 'top_waiters.sql', exact: true }).locator('a').click();
55+
56+
await window.waitForSelector('text=grain');
57+
await window.waitForSelector('text=Loaded SQLMesh Context')
58+
59+
// Go to definition for the model
60+
await window.locator("text=sushi.waiter_revenue_by_day").first().click({
61+
modifiers: ["Meta"]
62+
})
63+
await expect(window.locator('text=SUM(oi.quantity * i.price)::DOUBLE AS revenue')).toBeVisible();
64+
await close();
65+
} finally {
66+
await fs.removeSync(tempDir);
67+
}
68+
})

0 commit comments

Comments
 (0)