Skip to content

Commit

Permalink
[test] Basic test for worker
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Dec 9, 2011
1 parent f06c345 commit c710dc5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/worker-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var path = require('path'),
assert = require('assert'),
vows = require('vows'),
nssocket = require('nssocket'),
Worker = require('../lib/forever/worker').Worker;

var SOCKET_PATH = path.join(__dirname, 'fixtures');

vows.describe('forever/worker').addBatch({
'When using forever worker': {
'and starting it and pinging it': {
topic: function () {
var self = this;

var worker = new Worker({ sockPath: SOCKET_PATH }),
reader = new nssocket.NsSocket();

worker.start(function () {
reader.connect(path.join(SOCKET_PATH, 'worker.0.sock'), function () {
reader.data(['pong'], self.callback.bind(self, null));
reader.send(['ping']);
});
});
},
'it should respond with `pong`': function () {
}
}
}
}).export(module);

0 comments on commit c710dc5

Please sign in to comment.