tokenizer.distinct.test.js 772 B

123456789101112131415161718192021222324
  1. var Tokenizer = require('../../../index').query.tokenizer;
  2. var assert = require('assert');
  3. describe('Tokenizer ::', function() {
  4. describe('DISTINCT statements', function() {
  5. it('should generate a valid token array when DISTINCT is used', function() {
  6. var result = Tokenizer({
  7. select: {
  8. distinct: ['firstName', 'lastName']
  9. },
  10. from: 'customers'
  11. });
  12. assert.deepEqual(result, [
  13. { type: 'IDENTIFIER', value: 'DISTINCT' },
  14. { type: 'VALUE', value: ['firstName', 'lastName'] },
  15. { type: 'ENDIDENTIFIER', value: 'DISTINCT' },
  16. { type: 'IDENTIFIER', value: 'FROM' },
  17. { type: 'VALUE', value: 'customers' },
  18. { type: 'ENDIDENTIFIER', value: 'FROM' }
  19. ]);
  20. });
  21. });
  22. });