From f456237aa7197aef5f5cb2323faaa7da1c7e6817 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Fri, 6 Oct 2017 15:53:47 +0000 Subject: [PATCH] Drain client on after hook --- test/acceptance/buffer-size-format.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/acceptance/buffer-size-format.js b/test/acceptance/buffer-size-format.js index c32f62d1..236478b8 100644 --- a/test/acceptance/buffer-size-format.js +++ b/test/acceptance/buffer-size-format.js @@ -124,21 +124,28 @@ describe('buffer size per format', function () { } ]; + afterEach(function(done) { + if (this.testClient) { + return this.testClient.drain(done); + } + return done(); + }); + testCases.forEach(function (test) { it(test.desc, function (done) { - var testClient = new TestClient(test.mapConfig, 1234); + this.testClient = new TestClient(test.mapConfig, 1234); var coords = test.coords; var options = { format: test.format, layers: test.layers }; - testClient.getTile(coords.z, coords.x, coords.y, options, function (err, res, tile) { + this.testClient.getTile(coords.z, coords.x, coords.y, options, function (err, res, tile) { assert.ifError(err); // To generate images use: // tile.save(test.fixturePath); test.assert(tile, function (err) { assert.ifError(err); - testClient.drain(done); + return done(); }); }); });