Browse Source

Add babelmark responder test

pull/353/head
Vitaly Puzrin 8 years ago
parent
commit
aa74c1f727
  1. 1
      package.json
  2. 1
      test/.eslintrc.yml
  3. 49
      test/babelmark-responder.js

1
package.json

@ -58,6 +58,7 @@
"mocha": "*", "mocha": "*",
"ndoc": "^5.0.0", "ndoc": "^5.0.0",
"stylus": "~0.54.2", "stylus": "~0.54.2",
"supertest": "^3.0.0",
"uglify-js": "^2.7.3" "uglify-js": "^2.7.3"
} }
} }

1
test/.eslintrc → test/.eslintrc.yml

@ -1,3 +1,4 @@
env: env:
node: true node: true
mocha: true mocha: true
es6: true

49
test/babelmark-responder.js

@ -0,0 +1,49 @@
'use strict';
describe.only('babelmark responder app', function () {
var app;
var PORT = 5005;
var request = require('supertest')('http://127.0.0.1:' + PORT);
before(function (done) {
app = require('child_process').execFile(
'node',
[ '../support/babelmark-responder.js' ],
{
cwd: __dirname,
env: Object.assign({}, process.env, { PORT: PORT })
}
);
// Wait a bit until app bind port
setTimeout(done, 1000);
});
it('ping root', function () {
return request
.get('/')
.expect(200)
.expect(/<!DOCTYPE html>/i);
});
it('do request', function () {
return request
.get('/?text=foo')
.expect(200)
.expect({
html: '<p>foo</p>\n',
name: 'markdown-it',
version: require('../package.json').version
});
});
after(function () {
if (app) app.kill();
});
});
Loading…
Cancel
Save