move the SP related test to a new directory ./spec-sp
authorWolfram Schneider <wosch@indexdata.dk>
Fri, 10 Jan 2014 17:30:26 +0000 (17:30 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Fri, 10 Jan 2014 17:30:26 +0000 (17:30 +0000)
test/Makefile
test/spec-sp/mkws-index-jsdom.spec.js [new file with mode: 0644]
test/spec-sp/mkws_utils.js [new file with mode: 0644]
test/spec/mkws-index-jsdom.spec.js [deleted file]
test/spec/mkws_utils.js [deleted file]

index e1f5a09..e2d8fc2 100644 (file)
@@ -15,10 +15,8 @@ mkws-complete-syntax-check:
        ${MAKE} -C../tools/htdocs $@
 
 check: mkws-complete-syntax-check
-       for i in ./spec/*.js; do \
-         echo "$$i"; \
-         jasmine-node --noColor --captureExceptions --forceexit $$i; \
-       done
+       jasmine-node --noColor --captureExceptions --forceexit ./spec
+       jasmine-node --noColor --captureExceptions --forceexit ./spec-sp
 
 test: check
 
diff --git a/test/spec-sp/mkws-index-jsdom.spec.js b/test/spec-sp/mkws-index-jsdom.spec.js
new file mode 100644 (file)
index 0000000..6414a09
--- /dev/null
@@ -0,0 +1,55 @@
+/* Copyright (c) 2013 IndexData ApS. http://indexdata.com
+ *
+ * jQuery test with DOM/windows object
+ *
+ */
+
+
+var fs = require("fs");
+var utils = require("./mkws_utils.js");
+
+/*
+ * parse HTML data to DOM, and run jQuery request on it
+ *
+ */
+
+function jsdom_check(file, tags_array, ignore_doctype) {
+    var html = fs.readFileSync(file, "utf-8");
+    var tags = utils.flat_list(tags_array);
+
+    describe("local html file jsdom + jquery for " + file, function () {
+        var window = require('jsdom').jsdom(html, null, {
+            FetchExternalResources: false,
+            ProcessExternalResources: false,
+            MutationEvents: false,
+            QuerySelector: false
+        }).createWindow();
+
+        /* apply jquery to the window */
+        var $ = require('jQuery').create(window);
+
+
+        it("html jquery test", function () {
+            expect(html).toBeDefined();
+
+            expect($("body").length == 0).toEqual(false);
+            expect($("body").length == 1).toEqual(true);
+            expect($("head").length == 1).toEqual(true);
+
+            for (var i = 0; i < tags.length; i++) {
+                expect($("#" + tags[i]).length == 1).toEqual(true);
+            }
+        });
+
+        it("html jquery fail test", function () {
+            expect(html).toBeDefined();
+
+            expect($("body_does_not_exists").length == 1).toEqual(false);
+            expect($("#body_does_not_exists").length == 1).toEqual(false);
+        });
+    });
+}
+
+jsdom_check('../examples/htdocs/language.html', [utils.tags.required, utils.tags.optional, utils.tags.optional2]);
+jsdom_check('../examples/htdocs/mobile.html', [utils.tags.required, utils.tags.optional]);
+
diff --git a/test/spec-sp/mkws_utils.js b/test/spec-sp/mkws_utils.js
new file mode 100644 (file)
index 0000000..3256f70
--- /dev/null
@@ -0,0 +1,43 @@
+/* Copyright (c) 2013 IndexData ApS. http://indexdata.com
+ *
+ * helper functions for other test *.spec.js files
+ *
+ */
+
+/*
+ * combine arrays, return a flat list
+ * [["a","b"], ["c"], "d"] => ["a", "b", "c", "d"]
+ *
+ */
+var flat_list = function (list) {
+        var data = [];
+
+        for (var i = 0; i < list.length; i++) {
+            if (typeof list[i] == 'object') {
+                for (var j = 0; j < list[i].length; j++) {
+                    data.push(list[i][j]);
+                }
+
+            } else {
+                data.push(list[i]);
+            }
+        }
+
+        return data;
+    };
+
+/*
+ * list of div id to check
+ *
+ */
+var tags = {
+    required: ["mkwsSearch", "mkwsResults"],
+    optional: ["mkwsLang", "mkwsTargets"],
+    optional2: ["mkwsMOTD", "mkwsStat", "footer"]
+};
+
+// node.js exports
+module.exports = {
+    flat_list: flat_list,
+    tags: tags
+};
diff --git a/test/spec/mkws-index-jsdom.spec.js b/test/spec/mkws-index-jsdom.spec.js
deleted file mode 100644 (file)
index 6414a09..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (c) 2013 IndexData ApS. http://indexdata.com
- *
- * jQuery test with DOM/windows object
- *
- */
-
-
-var fs = require("fs");
-var utils = require("./mkws_utils.js");
-
-/*
- * parse HTML data to DOM, and run jQuery request on it
- *
- */
-
-function jsdom_check(file, tags_array, ignore_doctype) {
-    var html = fs.readFileSync(file, "utf-8");
-    var tags = utils.flat_list(tags_array);
-
-    describe("local html file jsdom + jquery for " + file, function () {
-        var window = require('jsdom').jsdom(html, null, {
-            FetchExternalResources: false,
-            ProcessExternalResources: false,
-            MutationEvents: false,
-            QuerySelector: false
-        }).createWindow();
-
-        /* apply jquery to the window */
-        var $ = require('jQuery').create(window);
-
-
-        it("html jquery test", function () {
-            expect(html).toBeDefined();
-
-            expect($("body").length == 0).toEqual(false);
-            expect($("body").length == 1).toEqual(true);
-            expect($("head").length == 1).toEqual(true);
-
-            for (var i = 0; i < tags.length; i++) {
-                expect($("#" + tags[i]).length == 1).toEqual(true);
-            }
-        });
-
-        it("html jquery fail test", function () {
-            expect(html).toBeDefined();
-
-            expect($("body_does_not_exists").length == 1).toEqual(false);
-            expect($("#body_does_not_exists").length == 1).toEqual(false);
-        });
-    });
-}
-
-jsdom_check('../examples/htdocs/language.html', [utils.tags.required, utils.tags.optional, utils.tags.optional2]);
-jsdom_check('../examples/htdocs/mobile.html', [utils.tags.required, utils.tags.optional]);
-
diff --git a/test/spec/mkws_utils.js b/test/spec/mkws_utils.js
deleted file mode 100644 (file)
index 3256f70..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (c) 2013 IndexData ApS. http://indexdata.com
- *
- * helper functions for other test *.spec.js files
- *
- */
-
-/*
- * combine arrays, return a flat list
- * [["a","b"], ["c"], "d"] => ["a", "b", "c", "d"]
- *
- */
-var flat_list = function (list) {
-        var data = [];
-
-        for (var i = 0; i < list.length; i++) {
-            if (typeof list[i] == 'object') {
-                for (var j = 0; j < list[i].length; j++) {
-                    data.push(list[i][j]);
-                }
-
-            } else {
-                data.push(list[i]);
-            }
-        }
-
-        return data;
-    };
-
-/*
- * list of div id to check
- *
- */
-var tags = {
-    required: ["mkwsSearch", "mkwsResults"],
-    optional: ["mkwsLang", "mkwsTargets"],
-    optional2: ["mkwsMOTD", "mkwsStat", "footer"]
-};
-
-// node.js exports
-module.exports = {
-    flat_list: flat_list,
-    tags: tags
-};