tokenizer.opts.schema.test.js 863 B

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