mirror of
https://github.com/knex/knex.git
synced 2025-08-11 10:10:56 +00:00
36 lines
664 B
JavaScript
36 lines
664 B
JavaScript
module.exports = function(knex) {
|
|
|
|
describe('Aggregate', function() {
|
|
|
|
it('has a sum', function() {
|
|
|
|
return knex('accounts').logMe().sum('logins');
|
|
|
|
});
|
|
|
|
it('has a count', function() {
|
|
|
|
return knex('accounts').logMe().count('id');
|
|
|
|
});
|
|
|
|
it('supports multiple aggregate functions', function() {
|
|
|
|
return knex('accounts').logMe().count('id').max('logins').min('logins');
|
|
|
|
});
|
|
|
|
it("support the groupBy function", function() {
|
|
|
|
return knex('accounts').logMe().count('id').groupBy('logins').then(function() {
|
|
return knex('accounts').logMe().count('id').groupBy('first_name');
|
|
});
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|