refactor: import readSQL function
This commit is contained in:
		@ -1,22 +1,14 @@
 | 
				
			|||||||
import FlinkSQL from '../../../../src/parser/flinksql';
 | 
					import FlinkSQL from '../../../../src/parser/flinksql';
 | 
				
			||||||
import fs from 'fs';
 | 
					import { readSQL } from '../../../helper';
 | 
				
			||||||
import path from 'path';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const parser = new FlinkSQL();
 | 
					const parser = new FlinkSQL();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const readSQL = (fileName: string) =>
 | 
					 | 
				
			||||||
    fs
 | 
					 | 
				
			||||||
        .readFileSync(path.join(__dirname, 'fixtures', fileName), 'utf-8')
 | 
					 | 
				
			||||||
        .split(';')
 | 
					 | 
				
			||||||
        .filter(Boolean)
 | 
					 | 
				
			||||||
        .map((i) => i.trim());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const features = {
 | 
					const features = {
 | 
				
			||||||
    table: readSQL('createTable.sql'),
 | 
					    table: readSQL(__dirname, 'createTable.sql'),
 | 
				
			||||||
    catalog: readSQL('createCatalog.sql'),
 | 
					    catalog: readSQL(__dirname, 'createCatalog.sql'),
 | 
				
			||||||
    database: readSQL('createDatabase.sql'),
 | 
					    database: readSQL(__dirname, 'createDatabase.sql'),
 | 
				
			||||||
    view: readSQL('createView.sql'),
 | 
					    view: readSQL(__dirname, 'createView.sql'),
 | 
				
			||||||
    function: readSQL('createFunction.sql'),
 | 
					    function: readSQL(__dirname, 'createFunction.sql'),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('FlinkSQL Create Syntax Tests', () => {
 | 
					describe('FlinkSQL Create Syntax Tests', () => {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user