mysql-query-validator
Version:
This is just a simple wrapper over [this Golang executable](https://github.com/xwb1989/sqlparser) to validate SQL queries.
30 lines • 772 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../");
test('does not throw on valid queries', () => {
const validQuery = `
create table test (
id varchar(20) not null,
created_at datetime(6),
slug varbinary(255),
enabled tinyint(1),
labels json,
url blob
)
`;
expect(() => __1.validate(validQuery)).not.toThrow();
});
test('throws on invalid queries', () => {
const invalidQuery = `
create table test (
id varchar(20) not null,
created_at datetime(6),
slug varbinary(255),
enabled tinyint(1),
labels json
url blob
)
`;
expect(() => __1.validate(invalidQuery)).toThrow();
});
//# sourceMappingURL=index.test.js.map