Skip to content

Commit 5d32c29

Browse files
authored
chore(lsp): format test files (#4628)
1 parent a4d2271 commit 5d32c29

File tree

6 files changed

+400
-298
lines changed

6 files changed

+400
-298
lines changed

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ vscode/extension/.vscode-test/
2323

2424
sqlmesh
2525
docs
26-
tests
26+
/tests/**
2727
examples
2828
posts
2929
.circleci
Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,48 @@
1-
import { test } from '@playwright/test';
2-
import path from 'path';
3-
import fs from 'fs-extra';
4-
import os from 'os';
5-
import { startVSCode, SUSHI_SOURCE_PATH } from './utils';
1+
import { test } from '@playwright/test'
2+
import path from 'path'
3+
import fs from 'fs-extra'
4+
import os from 'os'
5+
import { startVSCode, SUSHI_SOURCE_PATH } from './utils'
66

77
test('Workspace diagnostics show up in the diagnostics panel', async () => {
8-
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'));
9-
await fs.copy(SUSHI_SOURCE_PATH, tempDir);
10-
11-
const configPath = path.join(tempDir, 'config.py');
12-
const configContent = await fs.readFile(configPath, 'utf8');
13-
const updatedContent = configContent.replace('enabled=False', 'enabled=True');
14-
await fs.writeFile(configPath, updatedContent);
15-
16-
try {
17-
const { window, close } = await startVSCode(tempDir);
18-
19-
// Wait for the models folder to be visible
20-
await window.waitForSelector('text=models');
21-
22-
// Click on the models folder, excluding external_models
23-
await window.getByRole('treeitem', { name: 'models', exact: true }).locator('a').click();
24-
25-
// Open the customer_revenue_lifetime model
26-
await window.getByRole('treeitem', { name: 'customers.sql', exact: true }).locator('a').click();
27-
28-
await
29-
30-
// Open problems panel
31-
await window.keyboard.press(process.platform === 'darwin' ? 'Meta+Shift+P' : 'Control+Shift+P');
32-
await window.keyboard.type('View: Focus Problems');
33-
await window.keyboard.press('Enter');
34-
35-
36-
await window.waitForSelector('text=problems');
37-
await window.waitForSelector("text=All models should have an owner");
38-
39-
await close();
40-
} finally {
41-
await fs.remove(tempDir);
42-
}
43-
});
8+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'))
9+
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
10+
11+
const configPath = path.join(tempDir, 'config.py')
12+
const configContent = await fs.readFile(configPath, 'utf8')
13+
const updatedContent = configContent.replace('enabled=False', 'enabled=True')
14+
await fs.writeFile(configPath, updatedContent)
15+
16+
try {
17+
const { window, close } = await startVSCode(tempDir)
18+
19+
// Wait for the models folder to be visible
20+
await window.waitForSelector('text=models')
21+
22+
// Click on the models folder, excluding external_models
23+
await window
24+
.getByRole('treeitem', { name: 'models', exact: true })
25+
.locator('a')
26+
.click()
27+
28+
// Open the customer_revenue_lifetime model
29+
await window
30+
.getByRole('treeitem', { name: 'customers.sql', exact: true })
31+
.locator('a')
32+
.click()
33+
34+
await // Open problems panel
35+
await window.keyboard.press(
36+
process.platform === 'darwin' ? 'Meta+Shift+P' : 'Control+Shift+P',
37+
)
38+
await window.keyboard.type('View: Focus Problems')
39+
await window.keyboard.press('Enter')
40+
41+
await window.waitForSelector('text=problems')
42+
await window.waitForSelector('text=All models should have an owner')
43+
44+
await close()
45+
} finally {
46+
await fs.remove(tempDir)
47+
}
48+
})
Lines changed: 82 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,85 @@
1-
import { test, expect } from '@playwright/test';
2-
import path from 'path';
3-
import fs from 'fs-extra';
4-
import os from 'os';
5-
import { startVSCode, SUSHI_SOURCE_PATH } from './utils';
1+
import { test, expect } from '@playwright/test'
2+
import path from 'path'
3+
import fs from 'fs-extra'
4+
import os from 'os'
5+
import { startVSCode, SUSHI_SOURCE_PATH } from './utils'
66

77
test('Go to definition for macro', async () => {
8-
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'));
9-
await fs.copy(SUSHI_SOURCE_PATH, tempDir);
10-
11-
try {
12-
const { window, close } = await startVSCode(tempDir);
13-
14-
// Wait for the models folder to be visible
15-
await window.waitForSelector('text=models');
16-
17-
// Click on the models folder
18-
await window.getByRole('treeitem', { name: 'models', exact: true }).locator('a').click();
19-
20-
// Open the customer_revenue_lifetime model
21-
await window.getByRole('treeitem', { name: 'top_waiters.sql', exact: true }).locator('a').click();
22-
23-
await window.waitForSelector('text=grain');
24-
await window.waitForSelector('text=Loaded SQLMesh Context')
25-
26-
// Render the model
27-
await window.locator("text=@MULTIPLY").click({
28-
modifiers: ["Meta"]
29-
})
30-
31-
// Check if the model is rendered by check if "`oi`.`order_id` AS `order_id`," is in the window
32-
await expect(window.locator('text=def multiply(')).toBeVisible();
33-
34-
await close();
35-
} finally {
36-
await fs.removeSync(tempDir);
37-
}
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
51-
await window.getByRole('treeitem', { name: 'models', exact: true }).locator('a').click();
52-
53-
// Open the top_waiters 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"]
8+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'))
9+
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
10+
11+
try {
12+
const { window, close } = await startVSCode(tempDir)
13+
14+
// Wait for the models folder to be visible
15+
await window.waitForSelector('text=models')
16+
17+
// Click on the models folder
18+
await window
19+
.getByRole('treeitem', { name: 'models', exact: true })
20+
.locator('a')
21+
.click()
22+
23+
// Open the customer_revenue_lifetime model
24+
await window
25+
.getByRole('treeitem', { name: 'top_waiters.sql', exact: true })
26+
.locator('a')
27+
.click()
28+
29+
await window.waitForSelector('text=grain')
30+
await window.waitForSelector('text=Loaded SQLMesh Context')
31+
32+
// Render the model
33+
await window.locator('text=@MULTIPLY').click({
34+
modifiers: ['Meta'],
35+
})
36+
37+
// Check if the model is rendered by check if "`oi`.`order_id` AS `order_id`," is in the window
38+
await expect(window.locator('text=def multiply(')).toBeVisible()
39+
40+
await close()
41+
} finally {
42+
await fs.removeSync(tempDir)
43+
}
44+
})
45+
46+
test('Go to definition for model', async () => {
47+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'))
48+
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
49+
50+
try {
51+
const { window, close } = await startVSCode(tempDir)
52+
53+
// Wait for the models folder to be visible
54+
await window.waitForSelector('text=models')
55+
56+
// Click on the models folder
57+
await window
58+
.getByRole('treeitem', { name: 'models', exact: true })
59+
.locator('a')
60+
.click()
61+
62+
// Open the top_waiters model
63+
await window
64+
.getByRole('treeitem', { name: 'top_waiters.sql', exact: true })
65+
.locator('a')
66+
.click()
67+
68+
await window.waitForSelector('text=grain')
69+
await window.waitForSelector('text=Loaded SQLMesh Context')
70+
71+
// Go to definition for the model
72+
await window
73+
.locator('text=sushi.waiter_revenue_by_day')
74+
.first()
75+
.click({
76+
modifiers: ['Meta'],
6277
})
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-
})
78+
await expect(
79+
window.locator('text=SUM(oi.quantity * i.price)::DOUBLE AS revenue'),
80+
).toBeVisible()
81+
await close()
82+
} finally {
83+
await fs.removeSync(tempDir)
84+
}
85+
})

0 commit comments

Comments
 (0)