lava-oushudb-dt-sql-parser/test/parser/hive/syntax/alterStatement.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

64 lines
1.7 KiB
TypeScript

import { HiveSQL } from 'src/parser/hive';
import { readSQL } from 'test/helper';
const hive = new HiveSQL();
const features = {
databases: readSQL(__dirname, 'alterDatabase.sql'),
connectors: readSQL(__dirname, 'alterConnector.sql'),
tables: readSQL(__dirname, 'alterTable.sql'),
indexes: readSQL(__dirname, 'alterIndex.sql'),
views: readSQL(__dirname, 'alterView.sql'),
scheduleQueries: readSQL(__dirname, 'alterScheduleQuery.sql'),
};
describe('HiveSQL Alter Syntax Tests', () => {
describe('ALTER DATABASE', () => {
features.databases.forEach((db) => {
it(db, () => {
expect(hive.validate(db).length).toBe(0);
});
});
});
describe('ALTER CONNECTOR', () => {
features.connectors.forEach((ctors) => {
it(ctors, () => {
expect(hive.validate(ctors).length).toBe(0);
});
});
});
describe('ALTER TABLE', () => {
features.tables.forEach((tb) => {
it(tb, () => {
expect(hive.validate(tb).length).toBe(0);
});
});
});
describe('ALTER INDEX', () => {
features.indexes.forEach((index) => {
it(index, () => {
expect(hive.validate(index).length).toBe(0);
});
});
});
describe('ALTER VIEW', () => {
features.views.forEach((view) => {
it(view, () => {
expect(hive.validate(view).length).toBe(0);
});
});
});
describe('ALTER SCHEDULE QUERY', () => {
features.scheduleQueries.forEach((sq) => {
it(sq, () => {
expect(hive.validate(sq).length).toBe(0);
});
});
});
});