|
|
@@ -1,6 +1,7 @@
|
|
|
"use strict";
|
|
|
var assert = require("assert"),
|
|
|
- Pipeline = require("../../../lib/pipeline/Pipeline");
|
|
|
+ Pipeline = require("../../../lib/pipeline/Pipeline"),
|
|
|
+ DocumentSource = require('../../../lib/pipeline/documentSources/DocumentSource');
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
@@ -102,7 +103,7 @@ module.exports = {
|
|
|
"#run": {
|
|
|
"should set the parent source for all sources in the pipeline except the first one":function(next){
|
|
|
var p = Pipeline.parseCommand([{$test:{coalesce:false}}, {$test:{coalesce:false}}, {$test:{coalesce:false}}]);
|
|
|
- p.run({}, function(err, result){
|
|
|
+ p.run(new DocumentSource(), function(err, result){
|
|
|
assert.equal(p.sourceVector[1].pSource, p.sourceVector[0]);
|
|
|
assert.equal(p.sourceVector[2].pSource, p.sourceVector[1]);
|
|
|
next();
|
|
|
@@ -112,7 +113,7 @@ module.exports = {
|
|
|
"should iterate through sources and return resultant array":function(next){
|
|
|
var p = Pipeline.parseCommand([{$test:{coalesce:false}}, {$test:{coalesce:false}}, {$test:{coalesce:false}}]),
|
|
|
result = {};
|
|
|
- p.run(result, function(err, result){
|
|
|
+ p.run(new DocumentSource(), function(err, result){
|
|
|
|
|
|
assert.deepEqual(result.result, [5,4,3,2,1,0]);//see the test source for why this should be so
|
|
|
next();
|
|
|
@@ -125,4 +126,4 @@ module.exports = {
|
|
|
|
|
|
};
|
|
|
|
|
|
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();
|
|
|
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).grep(process.env.MOCHA_GREP || '').run(process.exit);
|