File tree Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Original file line number Diff line number Diff line change @@ -48,27 +48,20 @@ export default function supportsCommaPosition(format: FormatFn) {
48
48
) ;
49
49
} ) ;
50
50
51
- it ( 'adds comma before column in case with comment ' , ( ) => {
51
+ it ( 'handles comments after commas ' , ( ) => {
52
52
const result = format (
53
- `SELECT alpha,
54
- MAX(beta), --comment
55
- delta AS d, epsilon FROM gamma GROUP BY alpha, delta, epsilon
56
- ` ,
53
+ `SELECT alpha, --comment1
54
+ MAX(beta), --comment2
55
+ delta AS d, epsilon --comment3` ,
57
56
{ commaPosition : 'before' }
58
57
) ;
59
58
expect ( result ) . toBe (
60
59
dedent ( `
61
60
SELECT
62
- alpha
63
- , MAX(beta) --comment
61
+ alpha --comment1
62
+ , MAX(beta) --comment2
64
63
, delta AS d
65
- , epsilon
66
- FROM
67
- gamma
68
- GROUP BY
69
- alpha
70
- , delta
71
- , epsilon
64
+ , epsilon --comment3
72
65
` )
73
66
) ;
74
67
} ) ;
@@ -133,19 +126,19 @@ export default function supportsCommaPosition(format: FormatFn) {
133
126
134
127
it ( 'handles comments after commas' , ( ) => {
135
128
const result = format (
136
- `SELECT alpha, beta, --comment1
137
- delta, epsilon, iota --comment2
138
- ` ,
129
+ `SELECT alpha, --comment1
130
+ beta, --comment2
131
+ delta, epsilon, iota --comment3 ` ,
139
132
{ commaPosition : 'tabular' }
140
133
) ;
141
134
expect ( result ) . toBe (
142
135
dedent ( `
143
136
SELECT
144
- alpha ,
145
- beta , --comment1
137
+ alpha , --comment1
138
+ beta , --comment2
146
139
delta ,
147
140
epsilon,
148
- iota --comment2
141
+ iota --comment3
149
142
` )
150
143
) ;
151
144
} ) ;
You can’t perform that action at this time.
0 commit comments