File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import supportsOnConflict from './features/onConflict.js';
27
27
import supportsIsDistinctFrom from './features/isDistinctFrom.js' ;
28
28
import supportsArrayLiterals from './features/arrayLiterals.js' ;
29
29
import supportsDataTypeCase from './options/dataTypeCase.js' ;
30
+ import supportsTruncateTable from './features/truncateTable.js' ;
30
31
31
32
describe ( 'DuckDBFormatter' , ( ) => {
32
33
const language = 'duckdb' ;
@@ -50,8 +51,7 @@ describe('DuckDBFormatter', () => {
50
51
supportsInsertInto ( format ) ;
51
52
supportsOnConflict ( format ) ;
52
53
supportsUpdate ( format ) ;
53
- // TODO: only without-TABLE is supported
54
- // supportsTruncateTable(format, { withoutTable: true });
54
+ supportsTruncateTable ( format , { withTable : false , withoutTable : true } ) ;
55
55
supportsStrings ( format , [ "''-qq" , "X''" , "B''" ] ) ;
56
56
supportsIdentifiers ( format , [ `""-qq` ] ) ;
57
57
supportsBetween ( format ) ;
Original file line number Diff line number Diff line change @@ -3,19 +3,22 @@ import dedent from 'dedent-js';
3
3
import { FormatFn } from '../../src/sqlFormatter.js' ;
4
4
5
5
interface TruncateTableConfig {
6
+ withTable ?: boolean ;
6
7
withoutTable ?: boolean ;
7
8
}
8
9
9
10
export default function supportsTruncateTable (
10
11
format : FormatFn ,
11
- { withoutTable } : TruncateTableConfig = { }
12
+ { withTable = true , withoutTable } : TruncateTableConfig = { }
12
13
) {
13
- it ( 'formats TRUNCATE TABLE statement' , ( ) => {
14
- const result = format ( 'TRUNCATE TABLE Customers;' ) ;
15
- expect ( result ) . toBe ( dedent `
16
- TRUNCATE TABLE Customers;
17
- ` ) ;
18
- } ) ;
14
+ if ( withTable ) {
15
+ it ( 'formats TRUNCATE TABLE statement' , ( ) => {
16
+ const result = format ( 'TRUNCATE TABLE Customers;' ) ;
17
+ expect ( result ) . toBe ( dedent `
18
+ TRUNCATE TABLE Customers;
19
+ ` ) ;
20
+ } ) ;
21
+ }
19
22
20
23
if ( withoutTable ) {
21
24
it ( 'formats TRUNCATE statement (without TABLE)' , ( ) => {
You can’t perform that action at this time.
0 commit comments