sequelizer.delete.test.js 708 B

12345678910111213141516171819202122232425
  1. var Sequelizer = require('../../../index')({ dialect: 'postgres' }).sequelizer;
  2. var analyze = require('../../support/analyze');
  3. var assert = require('assert');
  4. describe('Sequelizer ::', function() {
  5. describe('DELETE statements', function() {
  6. it('should generate a simple query with an DELETE statement', function() {
  7. var tree = analyze({
  8. del: true,
  9. from: 'accounts',
  10. where: {
  11. and: [
  12. {
  13. activated: false
  14. }
  15. ]
  16. }
  17. });
  18. var result = Sequelizer(tree);
  19. assert.equal(result.sql, 'delete from "accounts" where "activated" = $1');
  20. assert.deepEqual(result.bindings, [false]);
  21. });
  22. });
  23. });