sequelizer.orderBy.test.js 680 B

12345678910111213141516171819202122232425
  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('ORDER BY statements', function() {
  6. it('should generate a simple query with ORDER BY statements', function() {
  7. var tree = analyze({
  8. select: ['*'],
  9. from: 'users',
  10. orderBy: [
  11. {
  12. name: 'desc'
  13. },
  14. {
  15. age: 'asc'
  16. }
  17. ]
  18. });
  19. var result = Sequelizer(tree);
  20. assert.equal(result.sql, 'select * from "users" order by "name" desc, "age" asc');
  21. });
  22. });
  23. });