Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
Close test-server after use. Fixes #22.
Browse files Browse the repository at this point in the history
Not stopping FakeServer after use broke the unit-tests on OS X.
  • Loading branch information
msiebuhr committed Dec 11, 2012
1 parent a9a0cca commit 6be275f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/EphemeralSocket.js
Expand Up @@ -17,6 +17,10 @@ describe('EphemeralSocket', function () {
s.start(done);
});

after(function () {
s.stop();
});

it("Send 50 messages", function (done) {
this.slow(500);
for (var i = 0; i < 50; i += 1) {
Expand Down
7 changes: 7 additions & 0 deletions test/FakeServer.js
Expand Up @@ -28,6 +28,13 @@ FakeServer.prototype.start = function (cb) {
this._socket.bind(this.port);
};

/* For closing server down after use.
*/
FakeServer.prototype.stop = function () {
this._socket.close();
this._socket = undefined;
};

/* Expect `message` to arrive and call `cb` if/when it does.
*/
FakeServer.prototype.expectMessage = function (message, cb) {
Expand Down
4 changes: 4 additions & 0 deletions test/StatsDClient.js
Expand Up @@ -23,6 +23,10 @@ describe('StatsDClient', function () {
s.start(done);
});

after(function () {
s.stop();
});

describe("Counters", function () {
it('.counter("abc", 1) → "abc:1|c', function (done) {
c.counter('abc', 1);
Expand Down

0 comments on commit 6be275f

Please sign in to comment.