NotExpression.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. var assert = require("assert"),
  3. NotExpression = require("../../../../lib/pipeline/expressions/NotExpression"),
  4. Expression = require("../../../../lib/pipeline/expressions/Expression");
  5. module.exports = {
  6. "NotExpression": {
  7. "constructor()": {
  8. "should not throw Error when constructing without args": function testConstructor(){
  9. assert.doesNotThrow(function(){
  10. new NotExpression();
  11. });
  12. }
  13. },
  14. "#getOpName()": {
  15. "should return the correct op name; $not": function testOpName(){
  16. assert.equal(new NotExpression().getOpName(), "$not");
  17. }
  18. },
  19. "#evaluateInternal()": {
  20. "should return false for a true input; false for true": function testStuff(){
  21. assert.strictEqual(Expression.parseOperand({$not:true}).evaluateInternal({}), false);
  22. },
  23. "should return true for a false input; true for false": function testStuff(){
  24. assert.strictEqual(Expression.parseOperand({$not:false}).evaluateInternal({}), true);
  25. }
  26. }
  27. }
  28. };
  29. if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);