summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2014-11-25 22:47:22 +0000
committerJohn McLear <john@mclear.co.uk>2014-11-25 22:47:22 +0000
commit3ac833d455dcf280e69c04a54cf7acd2e35dd91a (patch)
tree1692e0cf9eafdf110159d3542206c910ccef612a
parentad7de8277d75d6029d81d0039e40f80c9fb796e2 (diff)
downloadetherpad-lite-3ac833d455dcf280e69c04a54cf7acd2e35dd91a.zip
basic test runner
-rwxr-xr-xbin/backendTests.sh1
-rw-r--r--tests/backend/specs/api.js41
2 files changed, 42 insertions, 0 deletions
diff --git a/bin/backendTests.sh b/bin/backendTests.sh
new file mode 100755
index 00000000..ab07e012
--- /dev/null
+++ b/bin/backendTests.sh
@@ -0,0 +1 @@
+src/node_modules/mocha/bin/mocha --timeout 5000 --reporter nyan tests/backend/specs
diff --git a/tests/backend/specs/api.js b/tests/backend/specs/api.js
new file mode 100644
index 00000000..5cd567c6
--- /dev/null
+++ b/tests/backend/specs/api.js
@@ -0,0 +1,41 @@
+var assert = require("assert")
+ supertest = require('supertest'),
+ api = supertest('http://localhost:9001');
+
+describe('Array', function(){
+ describe('#indexOf()', function(){
+ it('should return -1 when the value is not present', function(){
+ assert.equal(-1, [1,2,3].indexOf(5));
+ assert.equal(-1, [1,2,3].indexOf(0));
+ })
+ })
+})
+
+describe('Connectivity', function(){
+ it('errors if can not connect', function(done) {
+ api.get('/api/')
+ .expect(200, done)
+ });
+})
+
+
+
+/*
+describe('Authentication', function() {
+
+ it('errors if wrong basic auth', function(done) {
+ api.get('/blog')
+ .set('x-api-key', '123myapikey')
+ .auth('incorrect', 'credentials')
+ .expect(401, done)
+ });
+
+ it('errors if bad x-api-key header', function(done) {
+ api.get('/blog')
+ .auth('correct', 'credentials')
+ .expect(401)
+ .expect({error:"Bad or missing app identification header"}, done);
+ });
+
+});
+*/