From 5ab4caea7d33b15163d46b9df7487d68240afc2d Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 16 May 2013 09:39:08 +0200 Subject: [PATCH] Make test for LZMA more robust in case of failure --- test/acceptance/server.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/acceptance/server.js b/test/acceptance/server.js index 7befe169..7a383a4c 100644 --- a/test/acceptance/server.js +++ b/test/acceptance/server.js @@ -793,26 +793,31 @@ suite('server', function() { //console.log("Compressing starts"); var next = this; helper.lzma_compress_to_base64(JSON.stringify(qo), 1, this); - //cosole.log("compress returned " + x ); }, function sendRequest(err, lzma) { + if ( err ) throw err; + var next = this; //console.log("Compressing ends: " + typeof(lzma) + " - " + lzma); assert.response(server, { headers: {host: 'localhost'}, url: '/tiles/test_table/15/16046/12354.png?lzma=' + encodeURIComponent(lzma), method: 'GET', encoding: 'binary' - },{}, this); + },{}, function(res) { next(null, res); }); }, - function checkResponse(res) { + function checkResponse(err, res) { + if ( err ) throw err; + var next = this; assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); var ct = res.headers['content-type']; assert.equal(ct, 'image/png'); assert.imageEqualsFile(res.body, './test/fixtures/test_table_15_16046_12354_styled_black.png', 2, function(err, similarity) { - if (err) throw err; - done(); + next(err); }); + }, + function finish(err) { + done(err); } ); });