2023-12-19 19:22:27 +08:00
|
|
|
import { TrinoSQL } from '../../../filters';
|
2023-10-13 11:16:36 +08:00
|
|
|
import { readSQL } from '../../../helper';
|
2023-05-24 15:07:02 +08:00
|
|
|
|
|
|
|
const features = {
|
|
|
|
table: readSQL(__dirname, 'alter_table.sql'),
|
|
|
|
view: readSQL(__dirname, 'alter_view.sql'),
|
|
|
|
schema: readSQL(__dirname, 'alter_schema.sql'),
|
2023-10-13 11:16:36 +08:00
|
|
|
materializedView: readSQL(__dirname, 'alter_materialized_view.sql'),
|
2023-05-24 15:07:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
describe('TrinoSQL Alter Statements Syntax Tests', () => {
|
|
|
|
const parser = new TrinoSQL();
|
|
|
|
features.table.forEach((sql) => {
|
|
|
|
it(sql, () => {
|
|
|
|
expect(parser.validate(sql).length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
features.view.forEach((sql) => {
|
|
|
|
it(sql, () => {
|
|
|
|
expect(parser.validate(sql).length).toBe(0);
|
|
|
|
});
|
2023-10-13 11:16:36 +08:00
|
|
|
});
|
2023-05-24 15:07:02 +08:00
|
|
|
features.schema.forEach((sql) => {
|
|
|
|
it(sql, () => {
|
|
|
|
expect(parser.validate(sql).length).toBe(0);
|
|
|
|
});
|
2023-10-13 11:16:36 +08:00
|
|
|
});
|
|
|
|
features.materializedView.forEach((sql) => {
|
2023-05-24 15:07:02 +08:00
|
|
|
it(sql, () => {
|
|
|
|
expect(parser.validate(sql).length).toBe(0);
|
|
|
|
});
|
2023-10-13 11:16:36 +08:00
|
|
|
});
|
2023-05-24 15:07:02 +08:00
|
|
|
});
|