analyzer.limit.test.js 833 B

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