refactor(test): import from src index file

This commit is contained in:
xiaowei 2021-01-05 17:41:21 +08:00
parent ca44962acc
commit 0f6c7849f2
8 changed files with 17 additions and 18 deletions

View File

@ -1,6 +1,7 @@
import SQLParser from '../../../src/parser/flinksql'; import { FlinkSQL } from '../../../src';
describe('FlinkSQL Lexer tests', () => { describe('FlinkSQL Lexer tests', () => {
const parser = new SQLParser(); const parser = new FlinkSQL();
const sql = 'SELECT * FROM table1'; const sql = 'SELECT * FROM table1';
const tokens = parser.getAllTokens(sql); const tokens = parser.getAllTokens(sql);

View File

@ -1,11 +1,9 @@
import import { FlinkSQL, FlinkSqlParserListener } from '../../../src';
SQLParser, { FlinkSqlParserListener }
from '../../../src/parser/flinksql';
describe('Flink SQL Listener Tests', () => { describe('Flink SQL Listener Tests', () => {
const expectTableName = 'user1'; const expectTableName = 'user1';
const sql = `select id,name,sex from ${expectTableName};`; const sql = `select id,name,sex from ${expectTableName};`;
const parser = new SQLParser(); const parser = new FlinkSQL();
const parserTree = parser.parse(sql); const parserTree = parser.parse(sql);

View File

@ -1,7 +1,7 @@
import SQLParser from '../../../src/parser/flinksql'; import { FlinkSQL } from '../../../src';
describe('FlinkSQL Syntax Tests', () => { describe('FlinkSQL Syntax Tests', () => {
const parser = new SQLParser(); const parser = new FlinkSQL();
// Create statements // Create statements
test('Test simple CreateTable Statement', () => { test('Test simple CreateTable Statement', () => {

View File

@ -1,9 +1,9 @@
import SQLParser, { FlinkSqlParserVisitor } from '../../../src/parser/flinksql'; import { FlinkSQL, FlinkSqlParserVisitor } from '../../../src';
describe('Flink SQL Visitor Tests', () => { describe('Flink SQL Visitor Tests', () => {
const expectTableName = 'user1'; const expectTableName = 'user1';
const sql = `select id,name,sex from ${expectTableName};`; const sql = `select id,name,sex from ${expectTableName};`;
const parser = new SQLParser(); const parser = new FlinkSQL();
const parserTree = parser.parse(sql, (error) => { const parserTree = parser.parse(sql, (error) => {
console.log('Parse error:', error); console.log('Parse error:', error);

View File

@ -1,7 +1,7 @@
import SQLParser from '../../../src/parser/generic'; import { GenericSQL } from '../../../src/';
describe('GenericSQL Lexer tests', () => { describe('GenericSQL Lexer tests', () => {
const mysqlParser = new SQLParser(); const mysqlParser = new GenericSQL();
const sql = 'select id,name,sex from user1;'; const sql = 'select id,name,sex from user1;';
const tokens = mysqlParser.getAllTokens(sql); const tokens = mysqlParser.getAllTokens(sql);

View File

@ -1,9 +1,9 @@
import SQLParser, { SqlParserListener } from '../../../src/parser/generic'; import { GenericSQL, SqlParserListener } from '../../../src';
describe('Generic SQL Listener Tests', () => { describe('Generic SQL Listener Tests', () => {
const expectTableName = 'user1'; const expectTableName = 'user1';
const sql = `select id,name,sex from ${expectTableName};`; const sql = `select id,name,sex from ${expectTableName};`;
const parser = new SQLParser(); const parser = new GenericSQL();
const parserTree = parser.parse(sql); const parserTree = parser.parse(sql);

View File

@ -1,7 +1,7 @@
import SQLParser from '../../../src/parser/generic'; import { GenericSQL } from '../../../src';
describe('Generic SQL Syntax Tests', () => { describe('Generic SQL Syntax Tests', () => {
const parser = new SQLParser(); const parser = new GenericSQL();
test('Select Statement', () => { test('Select Statement', () => {
const sql = 'select id,name from user1;'; const sql = 'select id,name from user1;';

View File

@ -1,9 +1,9 @@
import SQLParser, { SqlParserVisitor } from '../../../src/parser/generic'; import { GenericSQL, SqlParserVisitor } from '../../../src';
describe('Generic SQL Visitor Tests', () => { describe('Generic SQL Visitor Tests', () => {
const expectTableName = 'user1'; const expectTableName = 'user1';
const sql = `select id,name,sex from ${expectTableName};`; const sql = `select id,name,sex from ${expectTableName};`;
const parser = new SQLParser(); const parser = new GenericSQL();
const parserTree = parser.parse(sql, (error) => { const parserTree = parser.parse(sql, (error) => {
console.log('Parse error:', error); console.log('Parse error:', error);