knex/test/integration/builder/aggregate.js

30 lines
513 B
JavaScript
Raw Normal View History

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() {
2013-09-13 18:48:28 -04:00
return knex('accounts').logMe().count('id').groupBy('logins').then(function() {
return knex('accounts').logMe().count('id').groupBy('first_name');
});
});
});
};