aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Benden2014-12-15 18:08:18 (GMT)
committerJoseph Benden2014-12-15 18:08:18 (GMT)
commit1312dc3cab23ec82811c5daea39daf88e592478e (patch)
tree99622ff5a452b0af3e14ff143168bdfa7039a382
parent630d60ec106ed9aef720591c95d254f4c4e39e71 (diff)
downloadHLS-Streamer-JS-1312dc3cab23ec82811c5daea39daf88e592478e.zip
HLS-Streamer-JS-1312dc3cab23ec82811c5daea39daf88e592478e.tar.gz
HLS-Streamer-JS-1312dc3cab23ec82811c5daea39daf88e592478e.tar.bz2
HLS-Streamer-JS-1312dc3cab23ec82811c5daea39daf88e592478e.tar.xz
Initial unit test.
-rwxr-xr-xbin/test2
-rw-r--r--package.json10
-rw-r--r--test/apps/application.coffee31
-rw-r--r--test/models/all.coffee0
-rw-r--r--test/test.coffee0
-rw-r--r--test/test.js11
6 files changed, 49 insertions, 5 deletions
diff --git a/bin/test b/bin/test
index 64f18ad..6c268d2 100755
--- a/bin/test
+++ b/bin/test
@@ -17,5 +17,5 @@ else
17 MOCHA_ARGS="test/*.js test/*.coffee test/apps/*.coffee test/models/*.coffee" 17 MOCHA_ARGS="test/*.js test/*.coffee test/apps/*.coffee test/models/*.coffee"
18fi 18fi
19 19
20./node_modules/mocha/bin/mocha $MOCHA_ARGS 20./node_modules/mocha/bin/mocha --compilers coffee:coffee-script $MOCHA_ARGS
21 21
diff --git a/package.json b/package.json
index 11ace99..b7cad5b 100644
--- a/package.json
+++ b/package.json
@@ -22,10 +22,12 @@
22 "express-session": ">= 0.0.1" 22 "express-session": ">= 0.0.1"
23 }, 23 },
24 "devDependencies": { 24 "devDependencies": {
25 "node-dev": "~0.2.2", 25 "node-dev": "~2.6.0",
26 "mocha": "~0.14.1", 26 "mocha": "~2.0.1",
27 "request": "~2.9.153", 27 "request": "~2.51.0",
28 "libxmljs": "0.11.0" 28 "libxmljs": "0.12.0",
29 "chai": "~1.10.0",
30 "supertest": "~0.15.0"
29 }, 31 },
30 "scripts": { 32 "scripts": {
31 "test": "./bin/test", 33 "test": "./bin/test",
diff --git a/test/apps/application.coffee b/test/apps/application.coffee
new file mode 100644
index 0000000..905cd8d
--- /dev/null
+++ b/test/apps/application.coffee
@@ -0,0 +1,31 @@
1chai = require('chai')
2expect = chai.expect
3request= require('supertest')
4express= require('express')
5stylus = require('stylus')
6
7app = express()
8app.use(stylus.middleware({
9 src: __dirname + "/views",
10 dest: __dirname + "/public"
11}));
12app.set('views', __dirname + '/views');
13app.set('view engine', 'jade');
14app.engine('jade', require('jade').__express);
15app.set('view options', { layout: false });
16app.use(require('connect-assets')());
17routes = require('../../apps/sidewalk/routes')(app)
18
19describe "Routes", ->
20 describe "GET root", ->
21 it "should respond", ->
22 request(app).get('/')
23 .send()
24 .expect('Content-Type', /html/)
25 .expect(200)
26 .end (err, res) ->
27 if err
28 throw err
29 expect(res.charset).to.contain('utf-8')
30 expect(res.text).has.contain('toolbar')
31
diff --git a/test/models/all.coffee b/test/models/all.coffee
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/models/all.coffee
diff --git a/test/test.coffee b/test/test.coffee
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/test.coffee
diff --git a/test/test.js b/test/test.js
new file mode 100644
index 0000000..b42b0bc
--- /dev/null
+++ b/test/test.js
@@ -0,0 +1,11 @@
1var CoffeeScript = require('coffee-script');
2CoffeeScript.register();
3
4String.prototype.commafy = function () {
5 return this.replace(/(^|[^\w.])(\d{4,})/g, function($0, $1, $2) {
6 return $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, "$&,");
7 });
8}
9Number.prototype.commafy = function () {
10 return String(this).commafy();
11}