Skip to content

Commit

Permalink
Added manifest example test, #183
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed Oct 24, 2015
1 parent 9f977ae commit f93bb8b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ try {
console.dir(assetsData);
} catch (err) {
console.error('Failed compile assets: ' + (err.message || err.toString()));
process.exit(1);
}
25 changes: 22 additions & 3 deletions test/examples_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';


var spawn = require('child_process').spawn;
var child = require('child_process');
var path = require('path');
var _ = require('lodash');

Expand All @@ -17,20 +17,39 @@ describe('Examples', function () {
// Turn on compression modules for CSS & JS
var env = _.assign({}, process.env, { NODE_ENV: 'production' });

srv = spawn(path.join(__dirname, '../examples/server.js'), [], { env: env });
srv = child.spawn(path.join(__dirname, '../examples/server.js'), [], { env: env });

setTimeout(done, 1000);
});


it('Ping server demo', function (done) {
it('Server ping', function (done) {
request.get('/')
.expect(200)
.expect(/<!DOCTYPE html>/)
.end(done);
});


it('Manifest run', function (done) {
child.exec(path.join(__dirname, '../examples/manifest.js'), function (err) {
if (err) {
done(err);
return;
}

var manifest = require(path.join(__dirname, '../examples/public/assets/manifest.json'));

if (!manifest.assets) {
done(new Error('No assets found in manifest: ' + manifest));
return;
}

done();
});
});


after(function (done) {
if (srv) {
srv.kill();
Expand Down

0 comments on commit f93bb8b

Please sign in to comment.