avg.test.js 1.0 KB

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