From 6e879ce1d53b5e9516eb7c81d94af02e86a629ac Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Thu, 24 Dec 2015 15:00:26 -0800 Subject: [PATCH] Add hogfather basic structure. --- static/hogfather.js | 7 ++++++- static/test.js | 17 +++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/static/hogfather.js b/static/hogfather.js index e8503c8..1238723 100644 --- a/static/hogfather.js +++ b/static/hogfather.js @@ -21,8 +21,13 @@ * @constructor * @param {Cosmopolite} cosmo * @param {string} name + * @param {function()} onReady */ -var Hogfather = function(cosmo, name) { +var Hogfather = function(cosmo, name, onReady) { + cosmo.getProfile().then(function(profile_id) { + this.prefix_ = '/hogfather/' + profile_id + '/' + name + '/'; + onReady(); + }.bind(this)); }; diff --git a/static/test.js b/static/test.js index 7ad3748..03b65ea 100644 --- a/static/test.js +++ b/static/test.js @@ -947,14 +947,19 @@ QUnit.asyncTest('sendMessage admin ACL', function(assert) { QUnit.module('Hogfather'); -QUnit.test('Construct/shutdown', function(assert) { +QUnit.asyncTest('Construct/shutdown', function(assert) { assert.expect(4); var cosmo = new Cosmopolite(null, randstring()); assert.ok(true, 'new Cosmopolite() succeeds'); - var hogfather = new Hogfather(cosmo, randstring()); + + var hogfather = new Hogfather(cosmo, randstring(), function() { + hogfather.shutdown(); + assert.ok(true, 'Hogfather.shutdown() succeeds'); + + cosmo.shutdown(); + assert.ok(true, 'Cosmopolite.shutdown() succeeds'); + + QUnit.start(); + }); assert.ok(true, 'new Hogfather()) succeeds'); - hogfather.shutdown(); - assert.ok(true, 'Hogfather.shutdown() succeeds'); - cosmo.shutdown(); - assert.ok(true, 'Cosmopolite.shutdown() succeeds'); });