find.where.not.test.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. var Test = require('../../support/convert-runner');
  2. describe('Converter :: ', function() {
  3. describe('Find Where Not :: ', function() {
  4. it('should generate a find query', function() {
  5. Test({
  6. criteria: {
  7. model: 'user',
  8. method: 'find',
  9. criteria: {
  10. where: {
  11. and: [
  12. {
  13. firstName: 'Test'
  14. },
  15. {
  16. age: {
  17. '!=': 40
  18. }
  19. }
  20. ]
  21. }
  22. }
  23. },
  24. query: {
  25. select: [],
  26. from: 'user',
  27. where: {
  28. and: [
  29. {
  30. firstName: 'Test'
  31. },
  32. {
  33. age: {
  34. '!=': 40
  35. }
  36. }
  37. ]
  38. }
  39. }
  40. });
  41. });
  42. it('should generate a find query when the NOT is a legacy value', function() {
  43. Test({
  44. criteria: {
  45. model: 'user',
  46. method: 'find',
  47. criteria: {
  48. where: {
  49. and: [
  50. {
  51. firstName: 'Test'
  52. },
  53. {
  54. age: {
  55. '!=': 40
  56. }
  57. }
  58. ]
  59. }
  60. }
  61. },
  62. query: {
  63. select: [],
  64. from: 'user',
  65. where: {
  66. and: [
  67. {
  68. firstName: 'Test'
  69. },
  70. {
  71. age: {
  72. '!=': 40
  73. }
  74. }
  75. ]
  76. }
  77. }
  78. });
  79. });
  80. it('should allow flexibility in usage', function() {
  81. Test({
  82. criteria: {
  83. model: 'user',
  84. method: 'find',
  85. criteria: {
  86. where: {
  87. and: [
  88. {
  89. firstName: 'Test'
  90. },
  91. {
  92. age: {
  93. '!=': 40
  94. }
  95. }
  96. ]
  97. }
  98. }
  99. },
  100. query: {
  101. select: [],
  102. from: 'user',
  103. where: {
  104. and: [
  105. {
  106. firstName: 'Test'
  107. },
  108. {
  109. age: {
  110. '!=': 40
  111. }
  112. }
  113. ]
  114. }
  115. }
  116. });
  117. });
  118. });
  119. });