@@ -173,18 +173,25 @@ describe('ClickhouseFormatter', () => {
173173 it ( 'supports the ternary operator' , ( ) => {
174174 // NOTE: Ternary operators have a missing space because
175175 // ExpressionFormatter's `formatOperator` method special-cases `:`.
176- expect ( format ( 'SELECT foo?bar: baz;' ) ) . toBe ( 'SELECT\n foo ? bar: baz;' ) ;
176+ expect ( format ( 'SELECT foo?bar: baz;' ) ) . toBe ( dedent `
177+ SELECT
178+ foo ? bar: baz;
179+ ` ) ;
177180 } ) ;
178181
179182 // Should support the lambda creation operator
180183 it ( 'supports the lambda creation operator' , ( ) => {
181- expect ( format ( 'SELECT arrayMap(x->2*x, [1,2,3,4]) AS result;' ) ) . toBe (
182- 'SELECT\n arrayMap(x -> 2 * x, [1, 2, 3, 4]) AS result;'
183- ) ;
184+ expect ( format ( 'SELECT arrayMap(x->2*x, [1,2,3,4]) AS result;' ) ) . toBe ( dedent `
185+ SELECT
186+ arrayMap(x -> 2 * x, [1, 2, 3, 4]) AS result;
187+ ` ) ;
184188 } ) ;
185189
186190 it ( 'should support parameters' , ( ) => {
187- expect ( format ( 'SELECT {foo:Uint64};' , { params : { foo : "'123'" } } ) ) . toBe ( "SELECT\n '123';" ) ;
191+ expect ( format ( 'SELECT {foo:Uint64};' , { params : { foo : "'123'" } } ) ) . toBe ( dedent `
192+ SELECT
193+ '123';
194+ ` ) ;
188195 expect ( format ( 'SELECT {foo:Map(String, String)};' , { params : { foo : "{'bar': 'baz'}" } } ) ) . toBe (
189196 dedent `
190197 SELECT
@@ -568,9 +575,8 @@ describe('ClickhouseFormatter', () => {
568575 // https://clickhouse.com/docs/sql-reference/statements/alter/order-by
569576 describe ( 'ALTER ORDER BY statements' , ( ) => {
570577 it ( 'formats ALTER TABLE MODIFY ORDER BY' , ( ) => {
571- expect (
572- format ( 'ALTER TABLE db.events ON CLUSTER prod MODIFY ORDER BY (user_id, timestamp);' )
573- ) . toBe ( dedent `
578+ expect ( format ( 'ALTER TABLE db.events ON CLUSTER prod MODIFY ORDER BY (user_id, timestamp);' ) )
579+ . toBe ( dedent `
574580 ALTER TABLE db.events
575581 ON CLUSTER prod
576582 MODIFY ORDER BY (user_id, timestamp);
@@ -937,7 +943,8 @@ describe('ClickhouseFormatter', () => {
937943 } ) ;
938944
939945 it ( 'formats DROP SETTINGS PROFILE' , ( ) => {
940- expect ( format ( 'DROP SETTINGS PROFILE IF EXISTS profile1, profile2 ON CLUSTER my_cluster;' ) ) . toBe ( dedent `
946+ expect ( format ( 'DROP SETTINGS PROFILE IF EXISTS profile1, profile2 ON CLUSTER my_cluster;' ) )
947+ . toBe ( dedent `
941948 DROP SETTINGS PROFILE IF EXISTS
942949 profile1,
943950 profile2
0 commit comments