| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 | 
							- "use strict";
 
- var assert = require("assert"),
 
- 	ConstantExpression = require("../../../../lib/pipeline/expressions/ConstantExpression");
 
- module.exports = {
 
- 	"ConstantExpression": {
 
- 		"constructor() / #evaluate": {
 
- 			"should be able to construct from a value type": function testCreate(){
 
- 				assert.strictEqual(new ConstantExpression(5).evaluate({}), 5);
 
- 			}
 
- 			//TODO: CreateFromBsonElement ? ?? ???
 
- 		},
 
- // TODO: the constructor() tests this so not really needed here
 
- //		"#evaluate()": {
 
- //		},
 
- 		"#optimize()": {
 
- 			"should not optimize anything": function testOptimize(){
 
- 				var expr = new ConstantExpression(5);
 
- 				assert.strictEqual(expr, expr.optimize());
 
- 			}
 
- 		},
 
- 		"#addDependencies()": {
 
- 			"should return nothing": function testDependencies(){
 
- 				assert.strictEqual(new ConstantExpression(5).addDependencies(), undefined);
 
- 			}
 
- 		},
 
- 		"#toJSON()": {
 
- 			"should output proper JSON": function testJson(){
 
- 				var expr = new ConstantExpression(5);
 
- 				assert.strictEqual(expr.toJSON(), 5);
 
- 				assert.deepEqual(expr.toJSON(true), {$const:5});
 
- 			}
 
- 		}
 
- 	}
 
- };
 
- if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 
 
  |