sequelizer.where.not.null.test.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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('WHERE NOT NULL statements', function() {
  6. it('should generate a query with a simple WHERE statement', function() {
  7. var tree = analyze({
  8. select: ['*'],
  9. from: 'users',
  10. where: {
  11. updatedAt: {
  12. not: null
  13. }
  14. }
  15. });
  16. var result = Sequelizer(tree);
  17. assert.equal(result.sql, 'select * from "users" where "updatedAt" is not null');
  18. });
  19. it('should generate a query with a simple WHERE statement (group clause)', function() {
  20. var tree = analyze({
  21. select: ['*'],
  22. from: 'users',
  23. where: {
  24. and: [
  25. {
  26. updatedAt: {
  27. not: null
  28. }
  29. }
  30. ]
  31. }
  32. });
  33. var result = Sequelizer(tree);
  34. assert.equal(result.sql, 'select * from "users" where "updatedAt" is not null');
  35. });
  36. });
  37. });