lava-oushudb-dt-sql-parser/test/parser/flink/syntax/createStatement.test.ts
Hayden bb0fad1dbe
refactor: standard naming (#278)
* refactor: rename flinksql to flink

* refactor: rename pgsql to postgresql

* refactor: rename trinosql to trino

* refactor: replace all default exports with named export

* refactor: rename basicParser to basicSQL

* refactor: rename basic-parser-types to types

* refactor: replace arrow func with plain func
2024-03-27 10:33:25 +08:00

51 lines
1.5 KiB
TypeScript

import { FlinkSQL } from 'src/parser/flink';
import { readSQL } from 'test/helper';
const flink = new FlinkSQL();
const features = {
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', () => {
describe('CREATE TABLE', () => {
features.table.forEach((table) => {
it(table, () => {
expect(flink.validate(table).length).toBe(0);
});
});
});
describe('CREATE CATALOG', () => {
features.catalog.forEach((catalog) => {
it(catalog, () => {
expect(flink.validate(catalog).length).toBe(0);
});
});
});
describe('CREATE DATABASE', () => {
features.database.forEach((database) => {
it(database, () => {
expect(flink.validate(database).length).toBe(0);
});
});
});
describe('CREATE VIEW', () => {
features.view.forEach((view) => {
it(view, () => {
expect(flink.validate(view).length).toBe(0);
});
});
});
describe('CREATE FUNCTION', () => {
features.function.forEach((func) => {
it(func, () => {
expect(flink.validate(func).length).toBe(0);
});
});
});
});