analyzer.delete.test.js 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. var Analyzer = require('../../../index').query.analyzer;
  2. var tokenize = require('../../support/tokenize');
  3. var assert = require('assert');
  4. describe('Analyzer ::', function() {
  5. describe('DELETE statements', function() {
  6. it('should generate a valid group for DELETE statements', function() {
  7. var tokens = tokenize({
  8. del: true,
  9. from: 'accounts',
  10. where: {
  11. and: [
  12. {
  13. activated: false
  14. }
  15. ]
  16. }
  17. });
  18. var result = Analyzer(tokens);
  19. assert.deepEqual(result, [
  20. [
  21. { type: 'IDENTIFIER', value: 'DELETE' }
  22. ],
  23. [
  24. { type: 'IDENTIFIER', value: 'FROM' },
  25. { type: 'VALUE', value: 'accounts' }
  26. ],
  27. [
  28. { type: 'IDENTIFIER', value: 'WHERE' },
  29. { type: 'CONDITION', value: 'AND' },
  30. [
  31. { type: 'KEY', value: 'activated' },
  32. { type: 'VALUE', value: false }
  33. ]
  34. ]
  35. ]);
  36. });
  37. });
  38. });