@@ -8,83 +8,80 @@ import {
88import { test , expect } from './fixtures'
99import { createPythonInterpreterSettingsSpecifier } from './utils_code_server'
1010
11- test . fixme (
12- 'noselectstar quickfix' ,
13- async ( { page, sharedCodeServer, tempDir } ) => {
14- await fs . copy ( SUSHI_SOURCE_PATH , tempDir )
15- await createPythonInterpreterSettingsSpecifier ( tempDir )
11+ test ( 'noselectstar quickfix' , async ( { page, sharedCodeServer, tempDir } ) => {
12+ await fs . copy ( SUSHI_SOURCE_PATH , tempDir )
13+ await createPythonInterpreterSettingsSpecifier ( tempDir )
1614
17- // Override the settings for the linter
18- const configPath = path . join ( tempDir , 'config.py' )
19- const read = await fs . readFile ( configPath , 'utf8' )
20- // Replace linter to be on
21- const target = 'enabled=True'
22- const replaced = read . replace ( 'enabled=False' , 'enabled=True' )
23- // Assert replaced correctly
24- expect ( replaced ) . toContain ( target )
15+ // Override the settings for the linter
16+ const configPath = path . join ( tempDir , 'config.py' )
17+ const read = await fs . readFile ( configPath , 'utf8' )
18+ // Replace linter to be on
19+ const target = 'enabled=True'
20+ const replaced = read . replace ( 'enabled=False' , 'enabled=True' )
21+ // Assert replaced correctly
22+ expect ( replaced ) . toContain ( target )
2523
26- // Replace the rules to only have noselectstar
27- const targetRules = `rules=[
24+ // Replace the rules to only have noselectstar
25+ const targetRules = `rules=[
2826 "noselectstar",
2927 ],`
30- const replacedTheOtherRules = replaced . replace (
31- `rules=[
28+ const replacedTheOtherRules = replaced . replace (
29+ `rules=[
3230 "ambiguousorinvalidcolumn",
3331 "invalidselectstarexpansion",
3432 "noselectstar",
3533 "nomissingaudits",
3634 "nomissingowner",
3735 "nomissingexternalmodels",
3836 ],` ,
39- targetRules ,
40- )
41- expect ( replacedTheOtherRules ) . toContain ( targetRules )
37+ targetRules ,
38+ )
39+ expect ( replacedTheOtherRules ) . toContain ( targetRules )
4240
43- await fs . writeFile ( configPath , replacedTheOtherRules )
44- // Replace the file to cause the error
45- const modelPath = path . join ( tempDir , 'models' , 'latest_order.sql' )
46- const readModel = await fs . readFile ( modelPath , 'utf8' )
47- // Replace the specific select with the select star
48- const modelReplaced = readModel . replace (
49- 'SELECT id, customer_id, start_ts, end_ts, event_date' ,
50- 'SELECT *' ,
51- )
52- await fs . writeFile ( modelPath , modelReplaced )
41+ await fs . writeFile ( configPath , replacedTheOtherRules )
42+ // Replace the file to cause the error
43+ const modelPath = path . join ( tempDir , 'models' , 'latest_order.sql' )
44+ const readModel = await fs . readFile ( modelPath , 'utf8' )
45+ // Replace the specific select with the select star
46+ const modelReplaced = readModel . replace (
47+ 'SELECT id, customer_id, start_ts, end_ts, event_date' ,
48+ 'SELECT *' ,
49+ )
50+ await fs . writeFile ( modelPath , modelReplaced )
5351
54- // Open the code server with the specified directory
55- await page . goto (
56- `http://127.0.0.1:${ sharedCodeServer . codeServerPort } /?folder=${ tempDir } ` ,
57- )
58- await page . waitForLoadState ( 'networkidle' )
52+ // Open the code server with the specified directory
53+ await page . goto (
54+ `http://127.0.0.1:${ sharedCodeServer . codeServerPort } /?folder=${ tempDir } ` ,
55+ )
56+ await page . waitForLoadState ( 'networkidle' )
5957
60- // Open the file with the linter issue
61- await page
62- . getByRole ( 'treeitem' , { name : 'models' , exact : true } )
63- . locator ( 'a' )
64- . click ( )
65- await page
66- . getByRole ( 'treeitem' , { name : 'latest_order.sql' , exact : true } )
67- . locator ( 'a' )
68- . click ( )
58+ // Open the file with the linter issue
59+ await page
60+ . getByRole ( 'treeitem' , { name : 'models' , exact : true } )
61+ . locator ( 'a' )
62+ . click ( )
63+ await page
64+ . getByRole ( 'treeitem' , { name : 'latest_order.sql' , exact : true } )
65+ . locator ( 'a' )
66+ . click ( )
6967
70- await waitForLoadedSQLMesh ( page )
68+ await waitForLoadedSQLMesh ( page )
7169
72- await openProblemsView ( page )
70+ await openProblemsView ( page )
7371
74- await page . getByRole ( 'button' , { name : 'Show fixes' } ) . click ( )
75- await page
76- . getByRole ( 'menuitem' , { name : 'Replace SELECT * with' } )
77- . first ( )
78- . click ( )
72+ await page . getByRole ( 'button' , { name : 'Show fixes' } ) . click ( )
73+ await page
74+ . getByRole ( 'menuitem' , { name : 'Replace SELECT * with' } )
75+ . first ( )
76+ . click ( )
7977
80- // Wait for the quick fix to be applied
81- await page . waitForTimeout ( 2_000 )
78+ // Wait for the quick fix to be applied
79+ await page . waitForTimeout ( 2_000 )
8280
83- // Assert that the model no longer contains SELECT * but SELECT id, customer_id, waiter_id, start_ts, end_ts, event_date
84- const readUpdatedFile = ( await fs . readFile ( modelPath ) ) . toString ( 'utf8' )
85- expect ( readUpdatedFile ) . not . toContain ( 'SELECT *' )
86- expect ( readUpdatedFile ) . toContain (
87- 'SELECT id, customer_id, waiter_id, start_ts, end_ts, event_date' ,
88- )
89- } ,
90- )
81+ // Assert that the model no longer contains SELECT * but SELECT id, customer_id, waiter_id, start_ts, end_ts, event_date
82+ const readUpdatedFile = ( await fs . readFile ( modelPath ) ) . toString ( 'utf8' )
83+ expect ( readUpdatedFile ) . not . toContain ( 'SELECT *' )
84+ expect ( readUpdatedFile ) . toContain (
85+ 'SELECT id, customer_id, waiter_id, start_ts, end_ts, event_date' ,
86+ )
87+ } )
0 commit comments