analyzer.count.test.js 715 B

123456789101112131415161718192021222324252627
  1. var Analyzer = require('../../../index').query.analyzer;
  2. var tokenize = require('../../support/tokenize');
  3. var assert = require('assert');
  4. describe('Analyzer ::', function() {
  5. describe('COUNT statements', function() {
  6. it('should generate a valid group when when COUNT is used', function() {
  7. var tokens = tokenize({
  8. count: 'active',
  9. from: 'users'
  10. });
  11. var result = Analyzer(tokens);
  12. assert.deepEqual(result, [
  13. [
  14. { type: 'IDENTIFIER', value: 'COUNT' },
  15. { type: 'VALUE', value: 'active' }
  16. ],
  17. [
  18. { type: 'IDENTIFIER', value: 'FROM' },
  19. { type: 'VALUE', value: 'users' }
  20. ]
  21. ]);
  22. });
  23. });
  24. });