Add support for ephemeral messages that are tied to an open channel, aka "pins".

This commit is contained in:
Ian Gulliver
2014-05-25 23:40:56 -07:00
parent 1e91f5babb
commit 8e7af2f5cf
6 changed files with 363 additions and 14 deletions

View File

@@ -441,6 +441,34 @@ asyncTest('sendMessage ACL', function() {
});
});
asyncTest('pin/unpin', function() {
expect(5);
var subject = randstring();
var message = randstring();
var callbacks = {
'onPin': function(e) {
equal(subject, e['subject']['name'], 'onPin: subject matches');
equal(message, e['message'], 'onPin: message matches');
equal(cosmo.getPins(subject).length, 1);
pin.then(function(id) {
cosmo.unpin(id);
});
},
'onUnpin': function(e) {
equal(subject, e['subject']['name'], 'onUnpin: subject matches');
equal(message, e['message'], 'onUnpin: message matches');
cosmo.shutdown();
start();
},
}
var cosmo = new Cosmopolite(callbacks, null, randstring());
cosmo.subscribe(subject);
var pin = cosmo.pin(subject, message);
});
module('dev_appserver only');