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, 'drop_table.sql'),
|
|
|
|
view: readSQL(__dirname, 'drop_view.sql'),
|
|
|
|
schema: readSQL(__dirname, 'drop_schema.sql'),
|
|
|
|
role: readSQL(__dirname, 'drop_role.sql'),
|
|
|
|
column: readSQL(__dirname, 'drop_column.sql'),
|
|
|
|
materializedView: readSQL(__dirname, 'drop_materialized_view.sql'),
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('TrinoSQL Drop Statements Syntax Tests', () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
const trino = new TrinoSQL();
|
2023-10-13 11:16:36 +08:00
|
|
|
features.table.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
|
|
|
});
|
|
|
|
});
|
|
|
|
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
|
|
|
});
|
2023-05-24 15:07:02 +08:00
|
|
|
|
|
|
|
features.column.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.role.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.materializedView.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
|
|
|
});
|