瀏覽代碼

Fixes #999. Finished test cases for FilterBase

http://source.rd.rcg.local/trac/eagle6/changeset/1325/Eagle6_SVN
Spencer Rathbun 12 年之前
父節點
當前提交
e3b9772897

+ 0 - 0
lib/pipeline/documentsource/FilterBaseDocumentSource.js → lib/pipeline/documentSources/FilterBaseDocumentSource.js


+ 56 - 0
test/lib/pipeline/documentSources/FilterBaseDocumentSource.js

@@ -0,0 +1,56 @@
+var assert = require("assert"),
+	FilterBaseDocumentSource = require("../../../../lib/pipeline/documentSources/FilterBaseDocumentSource");
+
+function createAccumulator(){
+	var fbds = new FilterBaseDocumentSource();
+	fbds.addOperand(new FieldPathExpression("a") );
+	return fbds;
+}
+
+/**
+ * none of the rest of this class can be tested, since all the methods depend on 
+ * accept, which is not implemented.
+ *
+ **/
+module.exports = {
+
+	"FilterBaseDocumentSource": {
+
+		"constructor()": {
+
+			"should not throw Error when constructing without args": function testConstructor(){
+				assert.doesNotThrow(function(){
+					new FilterBaseDocumentSource();
+				});
+			}
+
+		},
+
+		"#accept()": {
+
+			"should throw Error when calling toMatcherBson": function testConstructor(){
+				assert.throws(function(){
+					var fbds = new FilterBaseDocumentSource();
+					fbds.toMatcherBson();
+				});
+			}
+
+		},
+
+		"#toMatcherBson()": {
+
+			"should throw Error when calling toMatcherBson": function testConstructor(){
+				assert.throws(function(){
+					var fbds = new FilterBaseDocumentSource();
+					fbds.toMatcherBson();
+				});
+			}
+
+		}
+
+	}
+
+};
+
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
+