analyzer.distinct.test.js 799 B

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