2024-03-27 10:33:25 +08:00
|
|
|
import { ImpalaSQL } from 'src/parser/impala';
|
2024-01-19 21:10:00 +08:00
|
|
|
import { readSQL } from 'test/helper';
|
2023-11-28 21:11:07 +08:00
|
|
|
|
2024-03-27 10:33:25 +08:00
|
|
|
const impala = new ImpalaSQL();
|
2023-11-28 21:11:07 +08:00
|
|
|
|
|
|
|
const features = {
|
|
|
|
dbs: readSQL(__dirname, 'create_db.sql'),
|
|
|
|
functions: readSQL(__dirname, 'create_function.sql'),
|
|
|
|
roles: readSQL(__dirname, 'create_role.sql'),
|
|
|
|
tables: readSQL(__dirname, 'create_table.sql'),
|
|
|
|
views: readSQL(__dirname, 'create_view.sql'),
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('ImpalaSQL Create Syntax Tests', () => {
|
|
|
|
describe('CREATE DB', () => {
|
|
|
|
features.dbs.forEach((db) => {
|
|
|
|
it(db, () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
expect(impala.validate(db).length).toBe(0);
|
2023-11-28 21:11:07 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('CREATE FUNCTION', () => {
|
|
|
|
features.functions.forEach((db) => {
|
|
|
|
it(db, () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
expect(impala.validate(db).length).toBe(0);
|
2023-11-28 21:11:07 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('CREATE ROLE', () => {
|
|
|
|
features.roles.forEach((db) => {
|
|
|
|
it(db, () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
expect(impala.validate(db).length).toBe(0);
|
2023-11-28 21:11:07 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('CREATE TABLE', () => {
|
|
|
|
features.tables.forEach((db) => {
|
|
|
|
it(db, () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
expect(impala.validate(db).length).toBe(0);
|
2023-11-28 21:11:07 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('CREATE VIEW', () => {
|
|
|
|
features.views.forEach((db) => {
|
|
|
|
it(db, () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
expect(impala.validate(db).length).toBe(0);
|
2023-11-28 21:11:07 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|