mirror of
https://github.com/knex/knex.git
synced 2025-07-23 08:52:25 +00:00
32 lines
539 B
JavaScript
32 lines
539 B
JavaScript
![]() |
var when = require("when");
|
||
|
|
||
|
module.exports = function(knex) {
|
||
|
|
||
|
describe('aggregate', function() {
|
||
|
|
||
|
it('has a sum', function(ok) {
|
||
|
|
||
|
return Knex('accounts').sum('logins');
|
||
|
|
||
|
});
|
||
|
|
||
|
it('has a count', function(ok) {
|
||
|
|
||
|
return Knex('accounts').count('id');
|
||
|
|
||
|
});
|
||
|
|
||
|
it("support the groupBy function", function(ok) {
|
||
|
when.all([
|
||
|
Knex('accounts').count('id').groupBy('logins'),
|
||
|
Knex('accounts').count('id').groupBy('first_name')
|
||
|
]).then(resolver(ok, true), ok);
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
});
|
||
|
|
||
|
|
||
|
};
|