AnyElementExpression.js 1.1 KB

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