machinepack-postgresql
Version:
Structured Node.js bindings for connecting and running queries against a PostgreSQL database.
39 lines (35 loc) • 993 B
JavaScript
var assert = require('assert');
var Pack = require('../../../');
describe('Queryable ::', function() {
describe('Compile Statement', function() {
it('should generate a SQL Statement from a WLQL query', function(done) {
Pack.compileStatement({
statement: {
select: ['title', 'author', 'year'],
from: 'books'
}
})
.exec(function(err, report) {
if (err) {
return done(err);
}
assert.equal(report.nativeQuery, 'select "title", "author", "year" from "books"');
return done();
});
});
// TODO: Add lots of checking to the statement compiler
it.skip('should return the malformed exit for bad WLQL', function(done) {
Pack.compileStatement({
statement: {
foo: 'bar',
from: 'books'
}
})
.exec(function(err) {
assert(err);
assert.equal(err.exit, 'malformed');
return done();
});
});
});
});