Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions test/full-paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
var path = require('path');

var tap = require('tap'),
supertest = require('supertest'),
rimraf = require('rimraf');

var cdn = require('../').app;

var requestBody = JSON.stringify({
dependencies: {
'concat-stream': 'latest'
},
options: {
fullPaths: true
}
});


tap.test('multi-bundles build the first time', function (t) {
supertest(cdn)
.post('/multi')
.send(requestBody)
.expect('Content-Type', 'application/json')
.expect(200)
.end(function (err, res) {
t.error(err, 'Posting to /multi doesn\'t explode');

console.log(res.text) // delete this...

var body = {};

t.doesNotThrow(function () {
body = JSON.parse(res.text);
}, 'body is valid JSON');

var module = 'concat-stream'
console.log(body[module].bundle)
t.notEqual(body[module].bundle.indexOf(module), -1, module + ' includes bundle');

t.end();
})
;
});

tap.test('teardown', function (t) {
rimraf('./cdn.db', function (err) {
t.error(err, 'removed the database');
t.end();
setTimeout(function () {
process.stderr.write('# killing this because supertest is hanging\n');
process.exit(0);
}, 2000);
});
});