Correct function naming, actually get a test passing.
This commit is contained in:
@@ -59,9 +59,9 @@ hogfather.PublicChat = function(cosmo, id) {
|
|||||||
* @param {Cosmopolite} cosmo
|
* @param {Cosmopolite} cosmo
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
hogfather.PublicChat.Create = function(cosmo) {
|
hogfather.PublicChat.create = function(cosmo) {
|
||||||
var id = cosmo.uuid();
|
var id = cosmo.uuid();
|
||||||
return hogfather.PublicChat.Join(cosmo, id);
|
return hogfather.PublicChat.join(cosmo, id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -70,10 +70,10 @@ hogfather.PublicChat.Create = function(cosmo) {
|
|||||||
* @param {string} id
|
* @param {string} id
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
hogfather.PublicChat.Join = function(cosmo, id) {
|
hogfather.PublicChat.join = function(cosmo, id) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var chat = new hogfather.PublicChat(cosmo, id);
|
var chat = new hogfather.PublicChat(cosmo, id);
|
||||||
chat.Start_().then(function() {
|
chat.start_().then(function() {
|
||||||
resolve(chat);
|
resolve(chat);
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
@@ -86,7 +86,7 @@ hogfather.PublicChat.Join = function(cosmo, id) {
|
|||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
hogfather.PublicChat.prototype.Start_ = function() {
|
hogfather.PublicChat.prototype.start_ = function() {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
this.cosmo_.subscribe(this.subject_, -1).then(function() {
|
this.cosmo_.subscribe(this.subject_, -1).then(function() {
|
||||||
console.log(this.loggingPrefix_(), 'ready');
|
console.log(this.loggingPrefix_(), 'ready');
|
||||||
@@ -101,7 +101,7 @@ hogfather.PublicChat.prototype.Start_ = function() {
|
|||||||
/**
|
/**
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
hogfather.PublicChat.prototype.Shutdown = function() {
|
hogfather.PublicChat.prototype.shutdown = function() {
|
||||||
console.log(this.loggingPrefix_(), 'shutdown start');
|
console.log(this.loggingPrefix_(), 'shutdown start');
|
||||||
this.cosmo_.removeEventListener('message', this.boundOnMessage_);
|
this.cosmo_.removeEventListener('message', this.boundOnMessage_);
|
||||||
return this.cosmo_.unsubscribe(this.subject_);
|
return this.cosmo_.unsubscribe(this.subject_);
|
||||||
|
|||||||
@@ -947,34 +947,18 @@ QUnit.asyncTest('sendMessage admin ACL', function(assert) {
|
|||||||
|
|
||||||
QUnit.module('Hogfather');
|
QUnit.module('Hogfather');
|
||||||
|
|
||||||
QUnit.test('Construct/shutdown', function(assert) {
|
QUnit.asyncTest('PublicChat.create', function(assert) {
|
||||||
assert.expect(4);
|
|
||||||
|
|
||||||
var cosmo = new Cosmopolite(null, randstring());
|
|
||||||
assert.ok(true, 'new Cosmopolite() succeeds');
|
|
||||||
|
|
||||||
var hogfather = new Hogfather(cosmo, randstring());
|
|
||||||
assert.ok(true, 'new Hogfather()) succeeds');
|
|
||||||
|
|
||||||
hogfather.shutdown();
|
|
||||||
assert.ok(true, 'Hogfather.shutdown() succeeds');
|
|
||||||
|
|
||||||
cosmo.shutdown();
|
|
||||||
assert.ok(true, 'Cosmopolite.shutdown() succeeds');
|
|
||||||
});
|
|
||||||
|
|
||||||
QUnit.asyncTest('Create', function(assert) {
|
|
||||||
assert.expect(5);
|
assert.expect(5);
|
||||||
|
|
||||||
var cosmo = new Cosmopolite(null, randstring());
|
var cosmo = new Cosmopolite(null, randstring());
|
||||||
assert.ok(true, 'new Cosmopolite() succeeds');
|
assert.ok(true, 'new Cosmopolite() succeeds');
|
||||||
|
|
||||||
Hogfather.Create(cosmo).then(function(hogfather) {
|
hogfather.PublicChat.create(cosmo).then(function(chat) {
|
||||||
assert.ok(true, 'Hogfather.Create() succeeds');
|
assert.ok(true, 'Hogfather.Create() succeeds');
|
||||||
|
|
||||||
assert.ok(hogfather, 'Hogfather.Create() returns something');
|
assert.ok(chat, 'Hogfather.Create() returns something');
|
||||||
|
|
||||||
hogfather.shutdown();
|
chat.shutdown();
|
||||||
assert.ok(true, 'Hogfather.shutdown() succeeds');
|
assert.ok(true, 'Hogfather.shutdown() succeeds');
|
||||||
|
|
||||||
cosmo.shutdown();
|
cosmo.shutdown();
|
||||||
|
|||||||
Reference in New Issue
Block a user