Skip to content

Commit

Permalink
Add exit validation of message receipt.
Browse files Browse the repository at this point in the history
  • Loading branch information
pgriess committed Jun 7, 2010
1 parent a13e3ce commit f89b1b0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/test-simple.js
Expand Up @@ -6,14 +6,22 @@ var path = require('path');
var sys = require('sys');
var Worker = require('webworker').Worker;

var receivedMsg = false;

var w = new Worker(path.join(__dirname, 'workers', 'simple.js'));

w.onmessage = function(e) {
assert.ok('data' in e);
assert.equal(e.data.bar, 'foo');
assert.equal(e.data.bunkle, 'baz');

receivedMsg = true;

w.terminate();
};

w.postMessage({'foo' : 'bar', 'baz' : 'bunkle'});

process.addListener('exit', function() {
assert.equal(receivedMsg, true);
});

0 comments on commit f89b1b0

Please sign in to comment.