Browse Source

EAGLESIX-2892 moved old unit tests, fixed formatting

Austin Meagher 11 years ago
parent
commit
7b66722f8d

+ 2 - 2
test/lib/pipeline/DepsTracker.js

@@ -4,7 +4,7 @@ var assert = require("assert"),
 
 module.exports = {
     "DepsTracker": {
-        "toProjection()": {
+        "#toProjection()": {
             "should be able to convert dependencies to a projection": function(){
                 var deps = new DepsTracker(),
                     expected = {"_id":0,"a":1,"b":1};
@@ -47,7 +47,7 @@ module.exports = {
                 assert.deepEqual(expected, deps.toProjection());
             }
         },
-        "toParsedDeps()": {
+        "#toParsedDeps()": {
             "should not parse if needWholeDocument is true": function() {
                 var deps = new DepsTracker(),
                     expected;

+ 12 - 2
test/lib/pipeline/ParsedDeps.js

@@ -4,7 +4,17 @@ var assert = require("assert"),
 
 module.exports = {
     "ParsedDeps": {
-        "_documentHelper": {
+        "#extractFields": {
+            "should be able to convert a document to its projected form": function() {
+                var deps = {'a': true, 'b': true},
+                    doc = {a:23, b:64, c:92},
+                    parse = new ParsedDeps(deps);
+
+                var proj = parse.extractFields(doc);
+                assert.deepEqual({a:23,b:64}, proj);
+            }
+        },
+        "#_documentHelper": {
             "should skip fields that are not needed": function() {
                 var json = {'foo':'bar'},
                     neededFields = {},
@@ -38,7 +48,7 @@ module.exports = {
                 assert.deepEqual(expected, parse._documentHelper(json, neededFields));
             }
         },
-        "_arrayHelper": {
+        "#_arrayHelper": {
             "should call _documentHelper on values that are objects": function() {
                 var array = [{'foo':'bar'}],
                     neededFields = {'foo':true},

+ 0 - 42
test/lib/pipeline/documentSources/DocumentSource.js

@@ -7,50 +7,8 @@ module.exports = {
 
 	"DocumentSource": {
 
-		"#depsToProjection()": {
-			"should be able to convert dependencies to a projection": function(){
-				var array = {'a':1,'b':1},
-					expected = '{"_id":0,"a":1,"b":1}',
-					proj = DocumentSource.depsToProjection(array);
-
-				assert.equal(expected, JSON.stringify(proj));
-			},
-			"should be able to convert dependencies with subfields to a projection": function(){
-				var array = {'a':1,'a.b':1},
-					expected = '{"_id":0,"a":1}',
-					proj = DocumentSource.depsToProjection(array);
-
-				assert.equal(expected, JSON.stringify(proj));
-			},
-			"should be able to convert dependencies with _id to a projection": function(){
-				var array = {"_id":1,'a':1,'b':1},
-					expected = '{"a":1,"b":1,"_id":1}',
-					proj = DocumentSource.depsToProjection(array);
-
-				assert.equal(expected, JSON.stringify(proj));
-			},
-			"should be able to convert dependencies with id and subfields to a projection": function(){
-				var array = {'_id.a':1,'b':1},
-					expected = '{"_id":1,"b":1}',
-					proj = DocumentSource.depsToProjection(array);
-
-				assert.equal(expected, JSON.stringify(proj));
-			},
-		},
-
-		"#documentFromJsonWithDeps()": {
-			"should be able to convert a document to its projected form": function() {
-				var deps = {'a': true, 'b': true},
-					doc = {a:23, b:64, c:92};
-
-				var proj = DocumentSource.documentFromJsonWithDeps(doc, deps);
-				assert.deepEqual({a:23,b:64}, proj);
-			}
-		}
-
 	}
 
 };
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();
-