summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter 'Pita' Martischka <petermartischka@googlemail.com>2012-10-27 17:29:17 +0100
committerPeter 'Pita' Martischka <petermartischka@googlemail.com>2012-10-27 17:29:17 +0100
commit9537892c6111eae6257637627b233ce54c6620e6 (patch)
treeff4ad1e8661d5e5434f1b54e02392455ea10d0a8 /src
parentcac27c864a394ba7a6ce0cf6bf1e3f625c6a3d49 (diff)
downloadetherpad-lite-9537892c6111eae6257637627b233ce54c6620e6.zip
wrap spec files with a describe
Diffstat (limited to 'src')
-rw-r--r--src/node/hooks/express/tests.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/node/hooks/express/tests.js b/src/node/hooks/express/tests.js
index 793fcfd8..7921da5a 100644
--- a/src/node/hooks/express/tests.js
+++ b/src/node/hooks/express/tests.js
@@ -10,8 +10,8 @@ exports.expressCreateServer = function (hook_name, args, cb) {
});
});
- args.app.get('/tests/frontend/*', function (req, res) {
- var subPath = req.url.substr("/tests/frontend".length);
+ var url2FilePath = function(url){
+ var subPath = url.substr("/tests/frontend".length);
if (subPath == ""){
subPath = "index.html"
}
@@ -19,7 +19,24 @@ exports.expressCreateServer = function (hook_name, args, cb) {
var filePath = path.normalize(__dirname + "/../../../../tests/frontend/")
filePath += subPath.replace("..", "");
+ return filePath;
+ }
+
+ args.app.get('/tests/frontend/specs/*', function (req, res) {
+ var specFilePath = url2FilePath(req.url);
+ var specFileName = path.basename(specFilePath);
+
+ fs.readFile(specFilePath, function(err, content){
+ if(err){ return res.send(500); }
+
+ content = "describe(" + JSON.stringify(specFileName) + ", function(){ " + content + " });";
+ res.send(content);
+ });
+ });
+
+ args.app.get('/tests/frontend/*', function (req, res) {
+ var filePath = url2FilePath(req.url);
res.sendfile(filePath);
});