tokenizer.limit.test.js 835 B

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