distinct.test.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. var Test = require('../../support/test-runner');
  2. describe('Query Generation ::', function() {
  3. describe('DISTINCT statements', function() {
  4. it('should generate a distinct query', function(done) {
  5. Test({
  6. query: {
  7. select: {
  8. distinct: ['firstName', 'lastName']
  9. },
  10. from: 'customers'
  11. },
  12. outcomes: [
  13. {
  14. dialect: 'postgresql',
  15. sql: 'select distinct "firstName", "lastName" from "customers"',
  16. bindings: []
  17. },
  18. {
  19. dialect: 'mysql',
  20. sql: 'select distinct `firstName`, `lastName` from `customers`',
  21. bindings: []
  22. },
  23. {
  24. dialect: 'sqlite3',
  25. sql: 'select distinct "firstName", "lastName" from "customers"',
  26. bindings: []
  27. },
  28. {
  29. dialect: 'oracle',
  30. sql: 'select distinct "firstName", "lastName" from "customers"',
  31. bindings: []
  32. },
  33. {
  34. dialect: 'mariadb',
  35. sql: 'select distinct `firstName`, `lastName` from `customers`',
  36. bindings: []
  37. }
  38. ]
  39. }, done);
  40. });
  41. });
  42. });