sequelizer.select.test.js 811 B

123456789101112131415161718192021222324252627
  1. var Sequelizer = require('../../../index')({ dialect: 'postgres' }).sequelizer;
  2. var analyze = require('../../support/analyze');
  3. var assert = require('assert');
  4. describe('Sequelizer ::', function() {
  5. describe('SELECT statements', function() {
  6. it('should generate a query for select "*"', function() {
  7. var tree = analyze({
  8. select: ['*'],
  9. from: 'books'
  10. });
  11. var result = Sequelizer(tree);
  12. assert.equal(result.sql, 'select * from "books"');
  13. });
  14. it('should generate a query when defined columns are used', function() {
  15. var tree = analyze({
  16. select: ['title', 'author', 'year'],
  17. from: 'books'
  18. });
  19. var result = Sequelizer(tree);
  20. assert.equal(result.sql, 'select "title", "author", "year" from "books"');
  21. });
  22. });
  23. });