From 04a56ba618c112aeb134996b051aad76e421226b Mon Sep 17 00:00:00 2001 From: wewoor Date: Thu, 11 May 2023 18:12:50 +0800 Subject: [PATCH] refactor: import readSQL function --- .../flinksql/syntax/createStatement.test.ts | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/test/parser/flinksql/syntax/createStatement.test.ts b/test/parser/flinksql/syntax/createStatement.test.ts index 1c30155..97e82e5 100644 --- a/test/parser/flinksql/syntax/createStatement.test.ts +++ b/test/parser/flinksql/syntax/createStatement.test.ts @@ -1,22 +1,14 @@ import FlinkSQL from '../../../../src/parser/flinksql'; -import fs from 'fs'; -import path from 'path'; +import { readSQL } from '../../../helper'; 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 = { - table: readSQL('createTable.sql'), - catalog: readSQL('createCatalog.sql'), - database: readSQL('createDatabase.sql'), - view: readSQL('createView.sql'), - function: readSQL('createFunction.sql'), + table: readSQL(__dirname, 'createTable.sql'), + catalog: readSQL(__dirname, 'createCatalog.sql'), + database: readSQL(__dirname, 'createDatabase.sql'), + view: readSQL(__dirname, 'createView.sql'), + function: readSQL(__dirname, 'createFunction.sql'), }; describe('FlinkSQL Create Syntax Tests', () => {