Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Finish mail fixture test

  • Loading branch information...
commit b26209f7acf7dc40d5db5e09ab1beaae5629e103 1 parent d2dbf14
@felixge authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 test/system/test-mail-fixture.js
View
16 test/system/test-mail-fixture.js
@@ -4,18 +4,18 @@ var http = require('http');
var assert = require('assert');
var formidable = common.formidable;
+var files = [];
var server = http.createServer(function(req, res) {
var form = new formidable.IncomingForm();
form.uploadDir = common.dir.tmp;
form.parse(req);
form
- .on('file', function(file) {
- console.log(arguments);
+ .on('file', function(name, file) {
+ files.push(file);
})
.on('end', function() {
res.end('ok');
- server.close();
});
}).listen(common.port, function(err) {
if (err) throw err;
@@ -31,9 +31,17 @@ var server = http.createServer(function(req, res) {
};
var req = http.request(options, function(res) {
- console.log('got res');
+ server.close();
});
var file = fs.createReadStream(common.dir.fixture + '/mail.txt');
file.pipe(req);
});
+
+process.on('exit', function() {
+ assert.equal(files.length, 1);
+
+ var file = files[0];
+ assert.equal(file.size, 1668);
+ assert.equal(file.filename, 'favourite.gif');
+});
Please sign in to comment.
Something went wrong with that request. Please try again.