Permalink
Browse files

tests: 200 and ok

  • Loading branch information...
1 parent aa5b88f commit 9f9ecf4b1ead21c85e8d9047be5aef69effd5464 @spirinvladimir committed Mar 3, 2013
Showing with 32 additions and 3 deletions.
  1. +1 −1 app.js
  2. +2 −1 bin/logcat
  3. +2 −1 package.json
  4. +27 −0 test/app.js
View
2 app.js
@@ -60,4 +60,4 @@ logcat.on('exit', function (code) {
logcat = spawn('adb', ['logcat']);
});
-app.listen(80);
+module.exports = app;
View
3 bin/logcat
@@ -1,3 +1,4 @@
#!/usr/bin/env node
-require('../app.js');
+var app = require('../app.js');
+app.listen(80);
View
3 package.json
@@ -12,7 +12,8 @@
"description": "",
"main": "app.js",
"devDependencies": {
- "supertest": "~0.5.1"
+ "supertest": "~0.5.1",
+ "should": "~1.2.2"
},
"repository": {
"type": "git",
View
27 test/app.js
@@ -0,0 +1,27 @@
+var request = require('supertest'),
+ should = require('should'),
+ app = require('../app.js');
+
+describe('Response html with 200', function () {
+ it('should be responded as html', function (done) {
+ request(app)
+ .get('/')
+ .expect('Content-Type', /text\/html/)
+ .expect(200, done);
+ });
+});
+
+describe('GET /', function () {
+ it('res.ok okshould be true', function (done) {
+ request(app)
+ .get('/')
+ .end(function (err, res) {
+ if (err) return done(err);
+ //res.text.should.include('logcat');
+ should.exist(res);
+ should.exist(res.body);
+ res.should.have.property('ok', true);
+ done();
+ });
+ });
+});

0 comments on commit 9f9ecf4

Please sign in to comment.