2024-03-27 10:33:25 +08:00
|
|
|
import { TrinoSQL } from 'src/parser/trino';
|
2024-01-19 21:10:00 +08:00
|
|
|
import { readSQL } from 'test/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', () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
const trino = new TrinoSQL();
|
2023-05-24 15:07:02 +08:00
|
|
|
features.table.forEach((sql) => {
|
|
|
|
it(sql, () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
expect(trino.validate(sql).length).toBe(0);
|
2023-05-24 15:07:02 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
features.view.forEach((sql) => {
|
|
|
|
it(sql, () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
expect(trino.validate(sql).length).toBe(0);
|
2023-05-24 15:07:02 +08:00
|
|
|
});
|
2023-10-13 11:16:36 +08:00
|
|
|
});
|
2023-05-24 15:07:02 +08:00
|
|
|
features.schema.forEach((sql) => {
|
|
|
|
it(sql, () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
expect(trino.validate(sql).length).toBe(0);
|
2023-05-24 15:07:02 +08:00
|
|
|
});
|
2023-10-13 11:16:36 +08:00
|
|
|
});
|
|
|
|
features.materializedView.forEach((sql) => {
|
2023-05-24 15:07:02 +08:00
|
|
|
it(sql, () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
expect(trino.validate(sql).length).toBe(0);
|
2023-05-24 15:07:02 +08:00
|
|
|
});
|
2023-10-13 11:16:36 +08:00
|
|
|
});
|
2023-05-24 15:07:02 +08:00
|
|
|
});
|