knex/test/integration/builder/aggregate.js

33 lines
536 B
JavaScript
Raw Normal View History

var when = require("when");
module.exports = function(knex) {
2013-09-12 13:30:47 -04:00
describe('Aggregate', function() {
it('has a sum', function() {
2013-09-12 13:30:47 -04:00
return knex('accounts').logMe().sum('logins');
});
it('has a count', function() {
2013-09-12 13:30:47 -04:00
return knex('accounts').logMe().count('id');
});
it("support the groupBy function", function() {
return when.all([
2013-09-12 13:30:47 -04:00
knex('accounts').logMe().count('id').groupBy('logins'),
knex('accounts').logMe().count('id').groupBy('first_name')
]);
});
});
};