orderBy.test.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. var Test = require('../../support/test-runner');
  2. describe('Query Generation ::', function() {
  3. describe('ORDER BY statements', function() {
  4. it('should generate a simple query with a FROM statement', function(done) {
  5. Test({
  6. query: {
  7. select: ['*'],
  8. from: 'users',
  9. orderBy: [{ name: 'desc' }, { age: 'asc' }]
  10. },
  11. outcomes: [
  12. {
  13. dialect: 'postgresql',
  14. sql: 'select * from "users" order by "name" desc, "age" asc',
  15. bindings: []
  16. },
  17. {
  18. dialect: 'mysql',
  19. sql: 'select * from `users` order by `name` desc, `age` asc',
  20. bindings: []
  21. },
  22. {
  23. dialect: 'sqlite3',
  24. sql: 'select * from "users" order by "name" desc, "age" asc',
  25. bindings: []
  26. },
  27. {
  28. dialect: 'oracle',
  29. sql: 'select * from "users" order by "name" desc, "age" asc',
  30. bindings: []
  31. },
  32. {
  33. dialect: 'mariadb',
  34. sql: 'select * from `users` order by `name` desc, `age` asc',
  35. bindings: []
  36. }
  37. ]
  38. }, done);
  39. });
  40. });
  41. });