Add test for subscribe barrier behavior

This commit is contained in:
Ian Gulliver
2014-05-18 19:12:32 +03:00
parent 6d7745c6cd
commit 56f0f3aeba

View File

@@ -274,6 +274,26 @@ test('getMessages/subscribe', function() {
cosmo.shutdown();
});
asyncTest('subscribe barrier', function() {
expect(2);
var subject = randstring();
var message = randstring();
var cosmo = new Cosmopolite({}, null, randstring());
cosmo.sendMessage(subject, message).then(function() {
cosmo.subscribe(subject, -1).then(function() {
// We are validating that the message event generated by the subscribe
// call has already been processed by the time this promise fires
equal(cosmo.getMessages(subject).length, 1, 'one message');
equal(cosmo.getMessages(subject)[0]['message'], message, 'message matches');
cosmo.shutdown();
start();
});
});
});
module('dev_appserver only');